Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 08f2090

Browse files
text updated
1 parent a6e17b7 commit 08f2090

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

‎Notes/10-Closures.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ console.log(z); // value of z is entire code of function y.
2222
When functions are returned from another fun, they still maintain their lexical scope.
2323
- When y is returned, not only is the fun returned but the entire closure (fun y + its lexical scope) is returned and put inside z. So when z is used
2424
somewhere else in program, it still remembers var a inside x()
25+
- Closure is a very powerful concept of JS, just because this function remembers things even if they are not in their lexical scope
2526

2627
### Uses of Closure
2728
Module Design Pattern, Currying, Functions like once(fun that can be run only once), memoize, maintaining state in async world, setTimeout, iterators...

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /