
- 2 min read
Select one option
1 / 10
console.log(typeof typeof 10)
JavaScript typeof — quiz answer sheet, click to expand.
Answer: string
Explanation: `typeof 10` returns "number" as a string, so you're actually doing `typeof "number"`, which is "string".
Answer: object
Explanation: Regular expressions in JavaScript are objects.
Answer: bigint
Explanation: The `n` suffix denotes a BigInt, which are numbers too high or too low to be represented by the number primitive.
Answer: undefined
Explanation: Accessing an undeclared variable with `typeof` doesn't throw an error — it returns "undefined".
Answer: object
Explanation: Arrays are objects in JavaScript. To check if something is an array, use `Array.isArray()`.
Answer: function
Explanation: Classes in JavaScript are just syntactic sugar for constructor functions under the hood.
Answer: object
Explanation: This is a well-known JavaScript bug. `typeof null` returns "object" even though null isn't an object.
Answer: number
Explanation: `NaN` stands for Not-a-Number, but ironically, `typeof NaN` is "number".
Answer: object
Explanation: Dates are objects too, to check if something is a Date, use `instanceof Date`.
Answer: symbol
Explanation: Symbols are a unique primitive type in JavaScript.