DEV Community

Cover image for What is "typeof" operator in JavaScript
Dhairya Shah
Dhairya Shah

Posted on • Originally published at codewithsnowbit.hashnode.dev

What is "typeof" operator in JavaScript

typeof operator determines the type of the input

For example,

console.log(typeof 9.8)
Enter fullscreen mode Exit fullscreen mode

The output will be - "number"

console.log(typeof "Gravitational acceleration of Earth is 9.8ms^-2")
Enter fullscreen mode Exit fullscreen mode

The output will be - "string"

console.log(typeof true)
Enter fullscreen mode Exit fullscreen mode

The output will be - boolean


Thank you for reading, have a nice day!

Top comments (0)