Skip to content

Instantly share code, notes, and snippets.

@codeangler
Created May 21, 2016 03:12
Show Gist options
  • Save codeangler/8080f82241a6ebcabd2bcd8e540a9c45 to your computer and use it in GitHub Desktop.
Save codeangler/8080f82241a6ebcabd2bcd8e540a9c45 to your computer and use it in GitHub Desktop.
https://repl.it/CT42/2 created by codeangler
favouriteColor = "green";
function showColor() {
var secondFavouriteColor = "red";
console.log(favouriteColor);
console.log(secondFavouriteColor);
}
showColor();
console.log(favouriteColor);
// doesn't display as local scope
console.log(secondFavouriteColor);
Native Browser JavaScript
>>> green
red
green
ReferenceError: secondFavouriteColor is not defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment