자바스크립트는 소스 실행전 실행하려는 함수가 선언되어있는지 확인하여 위로 끌어 올린다.
console.log(a());
console.log(b());
function a(){
return 'a';
}
var b = function() {
return 'b';
}
소스를 실행하게 되면 호이스팅되면서
function a(){
return 'a';
}
var b;
console.log(a());
console.log(b());
b = function() {
return 'b';
}
이런식으로 변경되어 실행됨.