- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript typeof
JavaScript Type System
JavaScript typeof
The
typeofoperator reports what kind of value you are holding.
It returns a string naming the type.
It has two famous quirks that are worth learning early.
Example
Example
javascript
console.log(typeof "hello");
console.log(typeof 42);
console.log(typeof true);The output is string, number, boolean.
What typeof Returns
One of: string, number, boolean, undefined, object, function, symbol or bigint.
