목록2021/06/24 (1)
Jiyong's STUDY
클로저(Closure)란?
클로저는 함수와 함수가 선언된 렉시컬 환경과의 조합이라고 한다. 클로저를 알기 위해서는 렉시컬 환경과 실행 컨텍스트에 대해서 알고 있어야만 비로소 알 수 있는 것이라고 말할 수 있다. function init() { var name = "Mozilla"; // name is a local variable created by init function displayName() { // displayName() is the inner function, a closure alert (name); // displayName() uses variable declared in the parent function } displayName(); } init(); // Mozilla에서 Closure를 설명하며 든 예시 ..
Web/자바스크립트
2021. 6. 24. 04:08