Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

typeof
javascript
datatype

Javascript typeof

Educative Answers Team

The typeof operator in Javascript returns the data type of the operand in the form of a string.​

svg viewer

Syntax

Look at the syntax of the typeof operator below.

svg viewer

Code

The code snippet below illustrates the usage of the typeof operator.

console.log(typeof 19);

console.log(typeof 'Educative');

console.log(typeof false);

// a variable declared but not initialized or defined
var x;
console.log(typeof x);

RELATED TAGS

typeof
javascript
datatype
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring