Your product could be here, in front of thousands of JavaScript developers. Sponsor this spot →
JavaScript Quiz

What does typeof typeof 1 return?

Do you know what will be the output of this code?

JavaScript
console.log(typeof typeof 1);
Show answer and explanation

This actually returns "string".

This expression is evaluated from right to left.

The first sub-expression evaluated actually is typeof 1 which will return "number".

Only after that the next sub-expression is evaluated which now is typeof "number" which returns "string".

Take the full quiz Next question →

More Types & typeof questions

  1. Why is typeof NaN "number" in JavaScript?
  2. Why is "a string" instanceof String false?
  3. Why is typeof null "object" in JavaScript?
  4. Is null equal to undefined in JavaScript?
  5. Why doesn't typeof throw for undeclared variables?

Related topics