Created
January 14, 2016 13:02
-
-
Save robsongomes/96ef3459a10d6f0d5e27 to your computer and use it in GitHub Desktop.
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 a = 10; | |
//Global Scope | |
function function1() { | |
var a = 20; // function1 Scope | |
console.log(a); //imprime 20 | |
function function2() { | |
var a = 30; //function2 scope | |
console.log(a); //imprime 30 | |
} | |
function2(); | |
console.log(a); // imprime 20 | |
} | |
console.log(a); //imprime 10 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment