var는 선언과 초기화가 동시에 진행됨 => undefined를 반환하는 이유
let은 선언과 초기화가 분리되어있음
const는 선언 + 초기화 + 할당
var => 함수 스코프(function-scoped)
const age = 30;
if(age > 19) {
var txt = "adult"
}
console.log(txt) // 'adult'
if문 안에서 선언된 var는 if문 바깥에서도 사용(?)이 된다 => let, const는 불가능
단 var도 함수 안에서는 못 벗어난다.
let, const =>(block-scoped)