number
bigint
string
boolean
undefined
symbol <-- 이건 나중에 찾아봐야겠다.
object
null
function
let test = "A";
test = 1;
값의 타입이 변경된다.
Infinity, -Infinity, NaN도 숫자형이다.
> typeof Infinity
'number'
const n = 333333333333333333333333333333333333333345454500099n
bigint
형이 된다.const a = "abc";
const b = 'abc';
const c = `abc`;
위 3개는 전부 같다.
``
는 벡틱이라 부른다.
`문자${"문자"}`
`문자${variable}`
형태로 사용가능하다.
const a = null;
의미로 사용된다.
const a;
const b = undefined;
초기값선언할때 사용한다.
typeof undefined
typeof 123
typeof Math // object
typeof null // object
typeof alert // funtion
null
이 object
형인건 하위호환성때문에 object
형으로 놧둔거다.
null
이 typeof
에서는 object
로 나오지만 실제로는 object
형이 아니다.
object
형으로 나오는건 javascript의 에러다
function
형은 실제로 없다. object
형에 가깝다.
하위호환성때문에 남겨진 상태인데 실무에선 유용하게 쓰인다.