Wowza Community

How do JavaScript closures work?

How would you explain JavaScript closures to someone with a knowledge of the concepts they consist of (for example functions, variables and the like), but does not understand closures themselves?

I have seen the Scheme example given on Wikipedia, but unfortunately it did not help.

Hello Alice,

In researching your question I found your StackOverflow post, and that is a better resource for a question of this nature.

Here is that post for others that may come across this forum post looking for an explanation:

https://stackoverflow.com/questions/111102/how-do-javascript-closures-work

Regards,
Jason Hatchett
Wowza Support Engineer