Content & privacy
Languages · INTERVIEW GUIDE

JavaScript & TypeScript

Scope, closures, async behavior, object identity, and the type system.

Practice this topic
Filters
4 questions

How does async JavaScript run?

JavaScript & TypeScript·Async JavaScript

Asynchronous JavaScript lets a program start work that may finish later without waiting synchronously for the result. A promise represents eventual completion, and async/await provides a readable way to work with promises. The runtime queues continuations and runs them when the current synchronous work has finished and the relevant checkpoints are reached.

Intermediate2 min read

Which Promise method should I use?

JavaScript & TypeScript·Async JavaScript

Promise combinators combine several promises into one result. The correct method depends on whether you need every success, every outcome, the first outcome or the first success. They observe promises; they do not automatically cancel ongoing operations when the combined result settles.

Intermediate2 min read

Why does forEach with async cause problems?

JavaScript & TypeScript·Async JavaScript

forEach calls a callback for each array item but ignores the values returned by those callbacks. An async callback returns a promise, so forEach does not wait for its completion or collect its rejection. Choose a loop or a promise combinator based on whether the operations depend on each other.

Intermediate2 min read

What causes a race condition?

JavaScript & TypeScript·Async JavaScript

A race condition happens when the result depends on the timing of operations that access shared state. JavaScript can have races even on one execution thread because asynchronous work pauses and lets other requests run between a read and a write. Databases and other processes can also update the same data concurrently.

Intermediate2 min read

Difficulty is an editorial estimate. Completion means you chose to mark a question as understood.