JS Built-ins
Operatorsadvanced

Operators β€” typeof and its quirks

typeof returns a string describing the type

Known quirks: typeof null === 'object' (historical bug), typeof [] is also 'object', but typeof function(){} is 'function'.

Challenge: Write typeofValues() returning the typeof result for: a number, string, boolean, undefined, null, array, function, and Symbol.

πŸ’‘ Hints (1)
  • β€’ typeof null === "object" is a famous JavaScript quirk from ES1