let a;
console.log(typeof a); // 출력: "undefined"

console.log(typeof true); // 출력: "boolean"

console.log(typeof 42); // 출력: "number"

console.log(typeof "Hello"); // 출력: "string"

typeof operand // operand는 피연산자를 의미함
let x = 42;
let y = "Hello";
let z = {key: "value"};

console.log(typeof x); // 출력: "number"
console.log(typeof y); // 출력: "string"
console.log(typeof z); // 출력: "object"
let a;
console.log(typeof a); // 출력: "undefined"

console.log(typeof true); // 출력: "boolean"

console.log(typeof 42); // 출력: "number"

console.log(typeof "Hello"); // 출력: "string"

console.log(typeof {}); // 출력: "object"

console.log(typeof [1, 2, 4]); // 출력: "object"

console.log(typeof new Date()); // 출력: "object"

console.log(typeof null); // 출력: "object"

console.log(typeof function() {}); // 출력: "function"

console.log(typeof class C {}); // 출력: "function"

console.log(typeof Math.sin); // 출력: "function"

console.log(typeof Symbol("foo")); // 출력: "symbol"

console.log(typeof 123n); // 출력: "bigint"
console.log(typeof null); // 출력: "object"
let regex = /[a-zA-Z]/;
console.log(typeof regex); // 출력: "object"
const arr = [1, 2, 3];
console.log(Array.isArray(arr)); // true
typeof 연산자의 브라우저 호환성
연산자
Chrome
Chrome
Edge
Edge
Firefox
Firefox
Safari
Safari
typeof 1 12 1 1

caniuse.com에서 더 자세한 정보를 확인해 보세요.