Skip to content
codinganthem

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

About 40% code reading

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.

Start practice

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.

  1. Question 1 · Easy · Types and coercion

    In JavaScript, what is the result of evaluating typeof null?
    1. A.object
    2. B.boolean
    3. C.null
    4. D.undefined
    Show answer

    A. object

    Due to a historical bug dating back to the first implementation of JavaScript, typeof null returns "object" rather than "null".
  2. Question 2 · Easy · Scope and closures

    What happens when you access a variable declared with let before its declaration line in the same block scope?
    1. A.It looks up the scope chain and resolves to the outer variable if present.
    2. B.It evaluates to undefined due to variable hoisting.
    3. C.A ReferenceError is thrown because the variable is in the Temporal Dead Zone.
    4. D.A TypeError is thrown because uninitialized variables cannot be resolved.
    Show answer

    C. A ReferenceError is thrown because the variable is in the Temporal Dead Zone.

    let declarations 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 a ReferenceError.
  3. Question 3 · Moderate · this and prototypes

    How does an arrow function determine its this binding when invoked?
    1. A.It defaults to the global object, or undefined in strict mode, unless bound with .bind().
    2. B.It dynamically binds to the caller's execution context when invoked.
    3. C.It adopts this from the enclosing lexical scope at the time it is defined.
    4. D.It binds to the object that precedes the dot at invocation time.
    Show answer

    C. It adopts this from 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.
  4. Question 4 · Advanced · Arrays and objects

    Which traversal order is strictly guaranteed by ECMAScript when using Reflect.ownKeys(obj) or Object.getOwnPropertyNames(obj)?
    1. A.All string and symbol keys strictly in insertion order regardless of whether keys are integer-like.
    2. B.No specific order is guaranteed by the specification; it is engine-dependent.
    3. C.Integer indices in ascending numerical order, followed by other string keys in insertion order, followed by symbol keys in insertion order.
    4. 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