DEV Community

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

Posted on • Originally published at codewithsnowbit.hashnode.dev

3 2

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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay