1. What will be the output of the following code? console.log(typeof null);
- null
- undefined
- object
- number
Reveal sample answer and explanation
Answer: object
Due to a historical bug, typeof null returns 'object'.
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.
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.
Answer: object
Due to a historical bug, typeof null returns 'object'.
Answer: ""
Both arrays are converted to empty strings and concatenated.
Answer: [object Object]
Empty array becomes empty string, object becomes '[object Object]'.