Something very curious happens in here. If you try this in the browser it gives you an error.
var counter = (function counterAdd() { let current = 0; return () => current = current + 1 }()); console.log(counterAdd);
Since the function has a name I would expect counterAdd to be available on scope but it isn't, it gives me a ReferenceError.
counterAdd
ReferenceError
Good Catch. My fault for posting late on Sunday night.... had a few codepens open I did and pulled from the wrong one. Updated and all good now.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Something very curious happens in here. If you try this in the browser it gives you an error.
Since the function has a name I would expect
counterAdd
to be available on scope but it isn't, it gives me aReferenceError
.Good Catch. My fault for posting late on Sunday night.... had a few codepens open I did and pulled from the wrong one.
Updated and all good now.