MDN에서는 클로저를 다음과 같이 정의합니다. A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). (번역) 클로저는 주변 상태 (렉시컬 환경)에 대한 참조와 함께 번들로 묶인 (포함된) 함수의 조합입니다. 위 정의만으로는 이해가 쉽게 되지 않습니다. 다음 예제를 보겠습니다. const a = 1; function outerFunc() { const a = 2; function innerFunc() { console.log(a); // 2 } innerFunc(); } outerFunc(); outerFunc 함..