AITeky Learn

AiTeky Original Interactive Learning & Practice Intermediate

JavaScript and TypeScript: coercion, the event loop and types at the edge

Understand why JavaScript says "5" equals 5 until you ask it strictly, in what order callbacks and promises really run, and why a typed program can still break on data that arrives from outside.

JavaScript runs almost every web page and, through Node.js, many servers. TypeScript adds types that are checked before the program runs. Three things surprise newcomers and catch experienced people too: automatic conversion between types, the order in which asynchronous work runs, and the fact that types vanish at run time, so data from a network call is only as safe as the check you wrote.

This course models those ideas with small Python programs you can run in your browser. Python stands in for JavaScript: the code is not JavaScript, but the rules and the orderings it shows are those of the language. Check the MDN and TypeScript documentation for exact syntax. All numbers are made up.

  • Learn lessons explain one idea at a time and let you run it.
  • Industry ready lessons decide and justify, and end with interview questions.

No JavaScript experience is assumed. Basic Python helps.

Locked. Sign up free

Learn

Understand each idea with everyday examples. No coding background needed.

  1. 00 25 min 🔒 AiTeky Pass Start here: values, types and loose equality Learn that every value has a type, see how JavaScript quietly converts one type into another when you compare, and why a strict comparison avoids the surprises.
  2. 01 30 min Free sample 🔒 AiTeky Pass Loose and strict equality Build a tiny model of how JavaScript's double-equals converts values before comparing, see the surprising results, and learn why triple-equals (no conversion) is the safe default.
  3. 02 30 min 🔒 AiTeky Pass The event loop decides the order Model JavaScript's single thread with a call stack, a queue of promise callbacks (run first) and a queue of timer callbacks (run after), and predict the order in which a small program prints.

Industry ready

Real problems from real jobs, and the questions interviewers ask about them.

  1. 03 35 min 🔒 AiTeky Pass On the job: the basket total that read 1020 A typed front end shows a basket total of "1020" instead of 30 after a back-end change. Model the data arriving as text, count the wrong totals under four fixes (a type cast, strict compiler settings, checking data at the edge, more tests), choose, and write the incident note.

We use essential cookies to run the site. With your permission we also set one anonymous ID to count unique visitors, and analytics cookies to see which pages help learners. Cookie notice

Join AiTeky Learn. It's free.

Create a free account to track your progress, save items for later and get study suggestions.

Sign up free Log in