참고: 이웅모 《모던 자바스크립트 Deep Dive》 6장
JS 값은 원시(number, string, boolean, undefined, null, symbol, bigint)와 객체로 나뉘고, 변수에 타입이 묶이지 않는 동적 타이핑이라 같은 변수에 다른 타입을 넣을 수 있다.
${표현식} 삽입.정적 타입 언어는 변수 선언 시 타입이 고정된다. JS는 값을 넣을 때 타입이 결정되고, 재할당으로 타입이 바뀔 수 있다. 편하지만 예기치 않은 암묵적 변환·버그의 온상이기도 하다.
typeof null === 'object'는 역사적 유산으로 외워 두는 게 낫다. typeof만으로 부족하면 Array.isArray, === null을 같이 쓴다.
let x = 10;
x = 'ten';
x = true;
const name = 'minsub';
const msg = `hello, ${name}`;
console.log(typeof null); // 'object'
console.log(typeof undefined); // 'undefined'
const empty = null;
let notSet; // undefined
타입을 알았으니, 값끼리 계산·비교하는 연산자로 넘어간다.