Skip to content

Instantly share code, notes, and snippets.

@DenisCangemi
Last active June 30, 2019 18:21
Show Gist options
  • Save DenisCangemi/baf223d9cc3a743b39b4a4dfb25c002d to your computer and use it in GitHub Desktop.
Save DenisCangemi/baf223d9cc3a743b39b4a4dfb25c002d to your computer and use it in GitHub Desktop.
Example of var keyword visibility
// Example of var keyword visibility
if ( true ) {
var x = 20;
}
function set() {
var x = 50;
// Write the values in the console
console.log(x); // Result : 50
var y = 30;
}
// Call the set() function
set();
// Write the values in the console
console.log(x); // Result : 20
console.log(y); // Result : Error not defined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment