Back to programming Quizzes

JavaScript Quiz (Advanced – Output Based)

This JavaScript Advanced Output-Based Quiz is designed for experienced developers who want to master JavaScript quirks and edge cases. The quiz focuses entirely on predicting the output of tricky JavaScript code snippets involving type coercion, equality checks, closures, operators, and internal language behavior—commonly asked in senior-level interviews.

10
Questions
~10
Minutes
10
Min Limit

Try a few sample questions

The question bank contains 20 questions. Your scored round uses up to 10 different questions. These samples are excluded from your round; try each one before opening its answer and explanation.

1. What will be the output of the following code? console.log(typeof null);

  1. null
  2. undefined
  3. object
  4. number
Reveal sample answer and explanation

Answer: object

Due to a historical bug, typeof null returns 'object'.

2. What will be the output? console.log([] + []);

  1. []
  2. 0
  3. ""
  4. undefined
Reveal sample answer and explanation

Answer: ""

Both arrays are converted to empty strings and concatenated.

3. What will be the output? console.log([] + {});

  1. [object Object]
  2. {}
  3. NaN
  4. undefined
Reveal sample answer and explanation

Answer: [object Object]

Empty array becomes empty string, object becomes '[object Object]'.