undefined
![[TIL] Undefined, null 의 차이점](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2Fbk5G5E%2FbtrBSZxxS5J%2Fk3u2Rykxouuj8QMLNFEMXk%2Fimg.png)
[TIL] Undefined, null 의 차이점
undefined와 null은 같아보이지만 차이점이 존재한다. 1. undefined undefined는 원시값(Primitive type) 중 하나로, 자바와는 달리 자바스크립트는 변수에 저장하는 값에 따라서 자료형이 결정된다는 특징이 있다. 이로 인해 자바스크립트 엔진이 해당 변수의 자료형이 정해지지 않는(Undefined) 상태(초기화 되지 않은 상태)임을 나타낼 때 자동으로 undefined를 반환한다. 다음과 같은 경우에 자바스크립트 엔진이 undefined를 자동으로 반환한다. 값을 할당하지 않은 변수나 값이 주어지지 않은 인수 메서드와 선언에서 변수가 할당받지 않을 때 함수가 값을 return하지 않을 때 undefined는 예약어가 아니므로, 변수이름으로 사용할 수 있지만, 유지보수와 디버..