JavaScript typeof Operator



typeof Operator

typeof is used for typeof operator

typeof operator takes a value/variable as operand on the right hand side, and returns their data type

typeof a
typeof "hello world"
typeof 3.14

Examples

1. Find type of string value "hello world".

a = "hello world";
output = typeof a;
console.log(output);

2. Find type of the value 3.14.

a = 3.14;
output = typeof a;
console.log(output);