일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- Database
- react
- 그레이들
- 다이나믹 프로그래밍
- db
- Graph
- git
- 동적 계획법
- Python
- 백준
- 안드로이드
- BFS
- Javascript
- DP
- DFS
- CS
- Redux
- 리트코드
- LeetCode
- 알고리즘
- Data Structure
- frontend
- vscode
- Algorithm
- network
- TypeScript
- VIM
- java
- 프로그래머스
- 자바
Archives
- Today
- Total
목록클로저 (1)
늘 겸손하게
JavaScript - 클로져(Closure)란?
1. 클로저 (Closure) 중첩 함수에서 내부 함수가 외부 함수의 Lexical Environment에 기록된 식별자를 기억하는 것을 클로저라 부릅니다. 함수와 그 함수가 선언됐을 때의 렉시컬 환경(Lexical Environment)과의 조합 function makeCounter() { let counter = 0; return function() { return counter++; }; } let counter = makeCounter(); alert( counter() ); // 0 alert( counter() ); // 1 alert( counter() ); // 2 외부 함수인 makeCounter 함수의 지역변수를 내부 함수인 function() { return counter++}가 자신..
Programming/JavaScript
2022. 8. 11. 12:23