typeof operator

This operator is used in order to check the data type of a given variable.

Example:

let newVariable = 'Playing around with typeof';

console.log(typeof newVariable);

// Output: string

newVariable = 1;

console.log(typeof newVariable);

// Output: number

Last updated