typeof

    javascript의 타입을 확인하는 typeof

    javascript는 총 7개의 타입을 갖고 있습니다. null undefined boolean number string object symbol (es6부터 추가) 위 타입들은 typeof 연산자로 확인할 수 있습니다. typeof undefined === "undefined"; // true typeof true === "boolean"; // true typeof 42 === "number" // true typeof "42" === "string" // true typeof { life: 42 } === "object" // true typeof Symbol() === "symbol" // true 하지만 null은 예외적으로 typeof에 대한 값이 object로 나옵니다. typeof null..