typeof Operator

noun

say it: “TYPE-uv OP-er-ay-ter” /ˈtaɪpəv ˈɒpəreɪtər/

The JavaScript operator that returns a value's type as text, such as "number" or "string".

What does typeof Operator do in JavaScript?

typeof Operator — An operator that returns a string describing a value's basic type.

const item = "tea";
const itemType = typeof item;

In a sentence

  • “typeof price returned "string", which explained why 1 + price gave "110".”

Level: Novice · More JavaScript terms at this level

Updated