Created
June 13, 2019 04:01
-
-
Save abirAbuAsim/43851888ca61b031ded313cf8c89c526 to your computer and use it in GitHub Desktop.
Revisions
-
abirAbuAsim created this gist
Jun 13, 2019 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ function simpleForLoopToShowVarBehavior() { for(var i = 0; i < 10; i++) { console.log(i); // You may think that i is scoped only inside this for loop } console.log(i); // Voila, for some magical reason you see '10' as output of this line // which means Javascript Var is not the variable declaration that you dreamt of // The i variable gets the value '10' from the last iteration of the for loop }