Using typeof


You can use typeof to check the data structure, or type, of a variable.

Note that in JavaScript, arrays are technically a type of object.

Try using typeof on each of the following to see which types they have.

console.log(typeof "");

console.log(typeof 0);

console.log(typeof []);

console.log(typeof {});