Last active
July 10, 2016 18:01
-
-
Save triacontane/2b7586253d89eb6cd95ec995e0d85a06 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 strJSON = undefined; | |
(function() { | |
'use strict'; | |
var strJSON = 'aaa'; | |
var testFunc = function() { | |
strJSON += 'bbb'; | |
var testFunc2 = function() { | |
strJSON += 'ccc'; | |
}; | |
testFunc2(); | |
}; | |
testFunc(); | |
console.log(strJSON); // 'aaabbbccc' | |
})(); | |
console.log(strJSON); // undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment