JavaScript skill check
Check your understanding of JavaScript behaviour that trips people up: coercion, closures, this, prototypes, promises, and the event loop, with snippets where you predict the output. Answers assume modern JavaScript (ES2023).
15
Questions
14 min
Timer can't pause
Multiple choice
ES2023
Choose a level
Question type
Topics
- Types and coercion
- Scope and closures
- this and prototypes
- Arrays and objects
- Promises and async
- Event loop
- Modules
- Error handling
Do
Use scratch paper or a notepad to work things out. Skip a question and come back to it later.
Don't
Run the code or look up answers during the check. Open the check in more than one tab or window.
Easy · Mixed · 15 questions · 14 min
By starting, you agree to the Terms and Privacy Policy.
Practice checks each answer as you go, with an explanation. The exam is checked when you submit; 9 of 15 passes and earns a certificate.
Checking your levels…
Certificates come from the certified exam: pass with 9 of 15 while signed in. View a sample certificate.
Sample JavaScript questions with answers
These are never used in a check, so seeing their answers here won't give anything away.
Question 1 · Easy · Types and coercion
In JavaScript, what is the result of evaluatingtypeof null?- A.
object - B.
boolean - C.
null - D.
undefined
Show answer
A.
objectDue to a historical bug dating back to the first implementation of JavaScript,typeof nullreturns"object"rather than"null".- A.
Question 2 · Easy · Scope and closures
What happens when you access a variable declared withletbefore its declaration line in the same block scope?- A.It looks up the scope chain and resolves to the outer variable if present.
- B.It evaluates to
undefineddue to variable hoisting. - C.A
ReferenceErroris thrown because the variable is in the Temporal Dead Zone. - D.A
TypeErroris thrown because uninitialized variables cannot be resolved.
Show answer
C. A
ReferenceErroris thrown because the variable is in the Temporal Dead Zone.letdeclarations are hoisted to the top of their block scope but remain uninitialized until the declaration statement is executed. Accessing them in this 'Temporal Dead Zone' results in aReferenceError.Question 3 · Moderate · this and prototypes
How does an arrow function determine itsthisbinding when invoked?- A.It defaults to the global object, or undefined in strict mode, unless bound with
.bind(). - B.It dynamically binds to the caller's execution context when invoked.
- C.It adopts
thisfrom the enclosing lexical scope at the time it is defined. - D.It binds to the object that precedes the dot at invocation time.
Show answer
C. It adopts
thisfrom the enclosing lexical scope at the time it is defined.Arrow functions do not have their own this binding; instead, they capture the this value of the enclosing lexical execution context at definition time, and this cannot be overridden even with call, apply, or bind.- A.It defaults to the global object, or undefined in strict mode, unless bound with
Question 4 · Advanced · Arrays and objects
Which traversal order is strictly guaranteed by ECMAScript when usingReflect.ownKeys(obj)orObject.getOwnPropertyNames(obj)?- A.All string and symbol keys strictly in insertion order regardless of whether keys are integer-like.
- B.No specific order is guaranteed by the specification; it is engine-dependent.
- C.Integer indices in ascending numerical order, followed by other string keys in insertion order, followed by symbol keys in insertion order.
- D.All string keys in insertion order, followed by integer indices in insertion order, followed by symbol keys in insertion order.
Show answer
C. Integer indices in ascending numerical order, followed by other string keys in insertion order, followed by symbol keys in insertion order.
The specification's[[OwnPropertyKeys]]internal method mandates: first, integer indices in ascending numeric order; second, all other string keys in chronological insertion order; third, symbol keys in chronological insertion order.
How scoring and certificates work
- Each check has 15 multiple-choice questions with one correct answer, and one timer for the whole check. A question you leave unanswered scores nothing.
- Practice is free without an account and shows whether each answer is right as you go, with an explanation.
- The certified exam is scored when you submit. 60% passes, which is 9 of 15. Easy unlocks Moderate, and Moderate unlocks Advanced.
- Passing the exam while signed in earns a free certificate, valid for one year, with its own verification page. See a sample certificate.
Free tools for JavaScript: JavaScript Formatter, JSON Formatter, Regex Tester