Closures in JS

I’m having a lot of trouble understanding how to use closures in JavaScript. A closure seems to be just a function within a function. I am still trying to find more examples of closures and their usage, so feel free to share any good ones you come across.

In the meantime, I found this Stack Overflow explanation pretty good:
http://stackoverflow.com/questions/111102/how-do-javascript-closures-work

 

Also finally found out what to call the ‘=>’ operator:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions

Advertisements

One thought on “Closures in JS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s