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
rockStar = “Mick Jagger”; | |
var rockStar; | |
console.log(rockStar); // Prints “Mick Jagger” |
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
console.log(rockStar); // Prints “undefined” | |
var rockStar = “Mick Jagger”; |
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 rockStar; | |
rockStar = “Mick Jagger”; |
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 rockStar; | |
console.log(rockStar); | |
rockStar = “Mick Jagger”; |
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
function movieStar() { // function declaration is moved to the top of the global scope | |
var name; // variable declaration is moved to the top of the local scope | |
name = “Meryl Streep”; // variable assignement is left in place | |
console.log(name); | |
} | |
movieStar(); // Prints “Meryl Streep” |
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
movieStar(); // Prints “TypeError : movieStar is not a function” | |
var movieStar = function () { // This is a function expression and therefore not hoisted | |
var name = “Philip Seymour Hoffman”; | |
console.log(name); | |
} |
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 movieStar = function () { | |
var name = “Philip Seymour Hoffman”; | |
console.log(name); | |
} | |
movieStar(); // Prints “Philipp Seymour Hoffman” |
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 businessStar; | |
function businessStar(){ | |
console.log(“Gary Vaynerchuck”); | |
} | |
console.log(businessStar); // Prints “function businessStar(){ console.log(“Gary Vaynerchuck”);}” |
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 businessStar = “Gary Vaynerchuck”; | |
function businessStar(){ | |
console.log(“Gary Vaynerchuck”); | |
} | |
console.log(businessStar); // Prints “Gary Vaynerchuck” |
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
movieStar(); | |
function movieStar() { | |
var name = “Meryl Streep”; | |
console.log(name); | |
} |
OlderNewer