+ 3
JavaScript Closure examples
I'm interested to see if anyone has really good examples of using JS Closures.
3 Respostas
+ 7
Hi Mike... Sorry for missing your question on this. If you are still interested in seeing an example, I made one about 6 months ago in response to the question below:
https://www.sololearn.com/Discuss/669904/?ref=app
https://code.sololearn.com/W41q8fBJ4tO4/?ref=app
+ 3
So just replying to my own question having now done some more learning.
The obvious place is to replace global variables.
A really common use case is in managing animation frame counters.
Here is example in my Divers watch app, which has to keep count of the rotation of the bezel using the mouse scroll wheel
https://code.sololearn.com/W83YJn5p0VmT/#js
+ 1
Hi David
some great examples cheers