This file contains 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 characters
var myVar = "my global variabl" | |
function hoistingSampleAsInterpreted() | |
{ | |
var myVar; | |
alert(myVar); //value is undefined | |
myVar = "my local variable"; //value is not undefined | |
alert(myVar); | |
} |
This file contains 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 characters
//Hoisting - Variable declarations moved to top of function by JavaScript engines | |
var myVar = "my global variabl" | |
function hoistingSampleAsInterpreted() | |
{ | |
var myVar = "my local variable"; | |
alert(myVar); | |
} |
No comments:
Post a Comment