Created
May 21, 2016 03:22
-
-
Save codeangler/f82499a727e77f74b1685c9da11672b0 to your computer and use it in GitHub Desktop.
https://repl.it/mVA/166 created by codeangler
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 food = "pizza"; | |
function getFood(){ | |
console.log(food); //what does this line alert? | |
// Assigning var food is hoisted w/n function w/o assignment and first console.log returns undefined. Then var food is assigned saugages and returns "sausages" | |
var food = "sausages"; | |
console.log(food); // what does this line alert? | |
} | |
getFood(); |
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
Native Browser JavaScript | |
>>> undefined | |
sausages |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment