type of a value.
JS ⟩ value ⟩ type ⟩ name ⟩ typeof
JS ⟩ operator ⟩ unary ⟩ typeof
(unary operator) determines the type of a value. (👉 type name)
⛔typeof let/const/class in TDZ gets an error❗️
👉 compare: typeName()
'boolean'
Boolean
'string'
String
'number'
Number
'bigint'
BigIntarrow-up-right
'symbol'
Symbolarrow-up-right
'undefined'
undefinedarrow-up-right
'function'
function
method
arrow function
generator function
class
'object'
nullarrow-up-right ( null is a primitive❗️)
any other objects, like
Object
Array
RegExp
Date
object literal
instances of class
...
typeof null === "object" // true
typeName() - refined version of typeof.
typeofarrow-up-right
Last updated 3 years ago
Was this helpful?