This site is a simple explanation with demonstrations of JavaScript Closures.
Since JavaScript does not have private variables closures are needed. For more explanation about the counter and closures check out W3 Schools. Also here is some additional information about the closure using calculator (no pun intended).
Although this site was not very exciting nor interactive, it was a great learning experience. I was much more attentive and engaged using and modifying the code, as well as trying to explain the concepts in my own words, than I would have been had I just read and tried to memorize. I think the lesson is that in order to learn coding concepts, I need to ideally build something that applies the concepts, but at the very least play around with the code and try to teach it.
3 thoughts on “Fun with Closures”