[JS] Hoisting 호이스팅

아직 선언하지 않은 변수를 호출하더라도 undefined가 출력된다면? 이것이 바로 호이스팅 console.log(a); // undefined; console.log(test);//undefined; console.log(test2); // function test2 () {...} 저 밑에 선언한 함수가 출력된다 오잉 var a='호이스팅'; // 호이스팅 되는 var 변수 //함수 표현식은 호이스팅 되지 않지 하지만 var test 변수는 호이스팅 된다. var test=function(){ console.log('test'); } //호이스팅이 되는 함수 선언문..!! function test2(){ console.log('test2'); } 분명 변수를 선언하기 전에 호출 먼저 했는데도 에러가 ..