Created
February 25, 2014 05:39
-
-
Save alexmcpherson/9203331 to your computer and use it in GitHub Desktop.
Functional scope in javascript
This file contains hidden or 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 scopeTest() { | |
var myVariable = 'Alex'; //var is important, declares it in this scope | |
console.log(myVariable); | |
} | |
scopeTest(); | |
typeof myVariable === "undefined"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment