This video explains what a “closure” is in JavaScript and how you can create one. We go over the basics of lexical scope and debate whether every single function is a closure by default or whether it must technically be a nested function to count (let us know what you think in the comments!). Finally we show an example of how you could use closures to create private properties and methods in your functions in a simple banking example.

#javascript #webdev

Closures in JavaScript
4.05 GEEK