es6에서는 7개의 data type (primitive + object/reference) 제공
es11에서
BigInt추가
number, string, boolean, undefined, null, symbol
객체, 함수, 배열 등
javascript에서는 하나의 숫자 타입만이 존재. 모두 실수로 처리함
double precision floating point number
console.log(1 === 1.0) // true아래 3가지 값도 표시 가능
Infinity, -Infinity, NaN
console.log(10 / 0); // Infinity
console.log(10 / -0); // -Infinity
console.log(1 \* 'string') // NaNUTF-16 의 집합multi-line string, expression interpolation, tagged template 등 편리한 문자열 처리 기능 제공escape sequence를 통해서 개행, 들여쓰끼 등을 적용해야 하지만 template literal내에서는 사용하지 않아도 적용 됨const first = 'hello'
const last = 'world'
console.log(`${first} ${last}!!`) // hello world!!
console.log(`1 + 2 = ${1 + 2}`) // 1 + 2 = 3true, falseundefinedundefined로 초기화 함javascript 엔진이 변수를 초기화 할 때 사용하는 값nullintentional absensees6에서 추가된 타입const key = Symbol('key')
console.log(typeof key) // symbol
const obj = {}
obj[key] = 'value'
console.log(obj[key]) // valuejavascript는 객체 기반 언어, 이루고 있는 거의 모든 것이 객체ECMAScript 사양은 string과 number 외에 데이터 타입의 크기를 명시적으로 규정하지 않음. 따라서 엔진 제조사의 구현에 따라 다를 수 있음number 타입은 double precision floating point number로 명시. 이는 8바이트로 숫자를 표현함0100 0001의 해석의 경우 number라면 65지만, string으로는 A이다. 따라서 올바른 해석을 위해 필요static/strong type의 언어는 변수를 선언할 때 data type을 사전에 선언해야함 explicit type declarationjavascript는 선언 시 타입 선언은 하지 않음dynamic typing, dynamic/weak type이를 위해선