r/javaScriptStudyGroup • • Feb 08 '16

Closures

One thing I've always noticed about Closures is that it seems to me really hard to find examples that have any kind of immediate practical use.
So I decided to give such a thing a go. Focusing on avoiding redeclaration of a variable

Closure Example
Hopefully it makes sense.

4 Upvotes

5 comments sorted by

View all comments

1

u/ForScale Feb 11 '16

Cool! Thanks for that!

One thing that I still struggle with is promises... Do you have any really basic examples of a js promise in action?

3

u/Volv Feb 11 '16

Don't have anything to hand because I'm away until Sunday. But the way I've seen it promises aren't a hundred miles off of how jquery implements it's ajax. .then() .done() .fail() .always(). Main benefit being flatter syntax. When I get back might do an example or two

1

u/ForScale Feb 11 '16

Cool, absolutely no rush, no worries! No need to do anything if you don't want to!

Thanks for staying active!!