Question Bank

JavaScript `typeof`, NaN, and Number Quirks Traces

Difficulty: Easy

Six traces covering the `typeof` chain, `isNaN` vs `Number.isNaN`, `parseInt` with `map`, the comma operator, `Object.is`, and `Number()` vs `new Number()`.

Question Bank
/

JavaScript `typeof`, NaN, and Number Quirks Traces

JavaScript `typeof`, NaN, and Number Quirks Traces

Six traces covering the `typeof` chain, `isNaN` vs `Number.isNaN`, `parseInt` with `map`, the comma operator, `Object.is`, and `Number()` vs `new Number()`.

Question Bank
Easy
JavaScript
6 questions
quiz
js-language
js-number-precision
fundamentals

295 views

3

What does the following code print, and why?

Examples

Example 1:

Input: console.log(typeof typeof 1)
Output: string
Explanation: Inner typeof 1 returns the string 'number', and typeof applied to any string is always 'string'.