Written by
java-style
on
on
0924_Javascript : 변수 Variable / 선언, 호이스팅
0924_Javascript : 변수 Variable / 선언, 호이스팅
Insert title here function sub() { // console.log(a); // 에러 : ReferenceError console.log(x); // undefined. 자바스크립트는 나중에 선언한 변수를 참조 할 수 있다. var x = 3; console.log(x); // 3 /* // 위는 아래와 동일 var x; console.log(x); x = 3; console.log(x); */ } sub(); 변수-호이스팅(hoisting) 호이스트는 변수의 정의가 그 범위에 따라 선언과 할당으로 분리되는 것을 의미
from http://development-writing.tistory.com/287 by ccl(S) rewrite - 2021-10-28 00:27:07