JavaScript Flashcards
7 cards from real Web Development practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 JavaScript flashcards as text
What is the purpose of the `Promise.all()` method?
Answer: Resolves when all promises resolve, or rejects if any one rejects
`Promise.all()` takes an iterable of promises and returns a single promise that resolves with an array of results when all input promises resolve.
What does the spread operator (`...`) do when used with an array?
Answer: Expands the array elements into individual arguments or elements
The spread operator expands an iterable like an array into individual elements, useful for function calls or array literals.
Which event fires when the DOM is fully loaded but before images and stylesheets have loaded?
Answer: DOMContentLoaded
`DOMContentLoaded` fires when the initial HTML is parsed and DOM is ready, without waiting for stylesheets, images, or subframes.
What is the result of `typeof undefined`?
Answer: 'undefined'
`typeof undefined` returns the string `'undefined'`, which is one of the few safe uses of `typeof` with uninitialized values.
How do you prevent an object's properties from being modified in JavaScript?
Answer: Object.freeze()
`Object.freeze()` prevents adding, removing, or modifying properties on an object.
What is the difference between `==` and `===` in JavaScript?
Answer: `==` performs type coercion before comparison; `===` requires both value and type to match
`==` (loose equality) coerces types before comparing, while `===` (strict equality) requires both value and type to be identical.
What does `Array.prototype.reduce()` do?
Answer: Executes a reducer function on each element to produce a single accumulated value
`reduce()` iterates over an array applying a callback to an accumulator and each element, ultimately returning a single value.
How this page was made: written with AI tools. We have not yet matched this exam's facts to an official source, so confirm fees, dates and rules with the exam body. Not reviewed by a subject-matter expert. Editorial policy