3 ms·
Local functions like that make sense if you want to access the outer function’s state - which is what’s happening here with `current`. It also makes it so other
by colejohnson66 5y ago
Local functions like that make sense if you want to access the outer function’s state - which is what’s happening here with `current`. It also makes it so others can’t use that function without having to make a separate module. Almost like a scoped “global” state. See also: IIFEs: https://developer.mozilla.org/en-US/docs/Glossary/IIFE https://developer.mozilla.org/en-US/docs/Glossary/IIFE
- tomcam 5y agoOf course! Totally obvious… Now that you bring it up! That’s much nicer than my non-scoped instinct. Thank you.