The typeof operator returns a string indicating the type of the unevaluated operand.
typeof
console.log(typeof 42); // expected output: "number" console.log(typeof 'blubber'); // expected output: "string" console.log(typeof true); // expected output: "boolean" console.log(typeof undeclaredVariable); // expected output: "undefined"
Last updated 3 years ago