개발자 삽살개
null과 undefined 차이 본문
undefined은 변수가 선언되어있지만, 아무 값도 할당받지 않은 상태
null은 변수를 선언하고 빈 값을 넣은 상태이다.
var a;
console.log(a); // undefined
console.log(typeof a); // undefined
var nullType = null;
console.log(typeof null); // object
Comments