The typeof operator is used to determine the type of a variable in JavaScript. It returns a string indicating the type of the operand. For example, typeof 42 returns 'number', typeof 'hello' returns 'string', and typeof true returns 'boolean'. However, typeof has some quirks: typeof null returns 'object' (a historical bug), typeof NaN returns 'number', and typeof for a function returns 'function', even though functions are technically objects in JavaScript.