[JS 33가지] 5. typeof vs instanceof
1. typeof typeof 연산자는 피 연산자의 자료형을 나타내는 문자열을 반환하는 함수다. console.log(typeof 42); // number console.log(typeof "str"); // string console.log(typeof true); // boolean console.log(typeof false); // boolean console.log(typeof function(){}) // function console.log(typeof {}); // object console.log(typeof []); // object 참조 타입이든 원시 타입이든 자료형을 나타내는데 크게 문제가 없는 것 같다. 하지만 typeof의 문제점은 null의 자료형을 나타내는 문자열을 반환하는..
2020.06.30