Question 1: What will be the output of the following code? console.log(typeof null);
- null
- undefined
- object
- number
Explanation: 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.
Explanation: Due to a historical bug, typeof null returns 'object'.
Explanation: Both arrays are converted to empty strings and concatenated.
Explanation: Empty array becomes empty string, object becomes '[object Object]'.
Explanation: {} is treated as a block, +[] evaluates to 0.
Explanation: Number is coerced to string, resulting in string concatenation.
Explanation: 1 + 2 = 3, then '3' + '3' = '33'.
Explanation: Loose equality converts both to numbers.
Explanation: Strict equality checks type and value.
Explanation: NaN is not equal to itself.
Explanation: NaN is of type number.
Explanation: [] becomes 0 and false becomes 0 during comparison.
Explanation: Arrays are converted to strings and concatenated.
Explanation: true becomes 1 and false becomes 0.
Explanation: Non-empty strings are truthy.
Explanation: 0 is a falsy value.
Explanation: typeof 1 is 'number', and typeof 'number' is 'string'.
Explanation: The string is coerced to a number.
Explanation: Double negation converts string to number, then concatenation occurs.
Explanation: Arrays are compared by reference.
Explanation: Objects are compared by reference.
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.