console.log(typeof 1) = number;
console.log(typeof '1') = string;
궁금한 점이 있다면
Array = [1, 2, 3]
배열을 선언하고
console.log(typeof Array) = object가 나온다.
모던 자바스크립트 Deep Dive를 참고했다.
자바스크립트 ES6는 7개의 데이터 타입을 제공한다.
7개의 데이터 타입은 원시 타입과 객체 타입으로 분류할 수 있고
원시 타입에는 number, string, boolean, undefined, null, symbol이라는 데이터 타입이 있다.
객체 타입에는 객체, 함수, 배열 등의 객체 데이터 타입만 존재한다.
따라서 배열을 선언하고 typeof로 입력하면 데이터 타입이 나오는 것이다.