Skip to content

Instantly share code, notes, and snippets.

@triacontane
Last active July 10, 2016 18:01
Show Gist options
  • Save triacontane/2b7586253d89eb6cd95ec995e0d85a06 to your computer and use it in GitHub Desktop.
Save triacontane/2b7586253d89eb6cd95ec995e0d85a06 to your computer and use it in GitHub Desktop.
変数のスコープについて
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