Skip to content

Commit 08f2090

Browse files
committed
text updated
1 parent a6e17b7 commit 08f2090

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

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)