MCQ Hive stays free thanks to ads. Please disable your ad blocker for this site so content and features keep working.
Data Types
Typing Disciplines & ADTs
Beginner
Q
In JavaScript, what are typeof null and typeof NaN?
A"object" and "undefined"
B"undefined" and "number"
C"null" and "NaN"
D"object" and "number"
Correct Answer:
D. "object" and "number"
Explanation:
typeof null returning "object" is a long-standing bug in the language. NaN is a numeric value.
ALSO KNOW (related points):
• Which description of JavaScript's typing is correct? → Dynamically and weakly typed
• What is the maximum number of nodes in a binary tree of height h (where a tree with only a root has height 0)? → 2^(h+1) - 1