JS Coding Questions Logo
JS Coding Questions
#72💼 Interview💻 Code

What is typeof operator

Advertisement

728x90

You can use the JavaScript typeof operator to find the type of a JavaScript variable. It returns the type of a variable or an expression.

javascript
1typeof "John Abraham"; // Returns "string"
2
3typeof (1 + 2); // Returns "number"
4
5typeof [1, 2, 3]; // Returns "object" because all arrays are also objects

Advertisement

Responsive Ad
🎯 Practice NowRelated Challenge

JavaScript Coding Exercise 73

Test your knowledge with this interactive coding challenge.

Start Coding

Advertisement

728x90
72of476