2019. 10. 11. 23:50ㆍJavaScript
참고자료 : 이해하기 쉬운 설명과 예제가 들어있는 사이트.
https://scotch.io/tutorials/understanding-hoisting-in-javascript
관련 한글자료
https://webcoding.tistory.com/115
Hoisting is a JavaScript mechanism where variables and function declarations are moved to the top of their scope before code execution. Inevitably, this means that no matter where functions and variables are declared, they are moved to the top of their scope regardless of whether their scope is global or local.
This mechanism only moves the declaration. The assignments are left in place.
All variable and function declarations are hoisted to the top of their scope.
However, in contrast, undeclared variables do not exist until code assigning them is executed. Therefore, assigning a value to an undeclared variable implicitly creates it as a global variable when the assignment is executed. This means that, all undeclared variables are global variables.
'JavaScript' 카테고리의 다른 글
자바스크립트 변수명에 대괄호 ...(2) (0) | 2019.10.12 |
---|---|
자바스크립트 변수명에 대괄호 ...(1) (0) | 2019.10.12 |
자바스크립트 reduce (0) | 2019.10.03 |
자바스크립트 map, filter (0) | 2019.10.03 |
자바스크립트 forEach (2) | 2019.09.30 |