Nice explaination, but I noticed a typo in this snippet, which confused me for a while:
var i = 8; function myFunc() { console.log(i); } (function(){ var i = 4; myFunc(); // > 0 })()
I think you did want to initialize i = 0 in the first line.
Please tell me its a typo cause I stop there thinking I didnt get anything
I updated the post as soon as he sent this comment. It was in fact a typo and it should be fixed. My deepest apologies.
Thanks, I was worried my english needed an improvement!
Yes, nice catch!
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.
Nice explaination, but I noticed a typo in this snippet, which confused me for a while:
I think you did want to initialize i = 0 in the first line.
Please tell me its a typo cause I stop there thinking I didnt get anything
I updated the post as soon as he sent this comment. It was in fact a typo and it should be fixed. My deepest apologies.
Thanks, I was worried my english needed an improvement!
Yes, nice catch!