Skip to content

Instantly share code, notes, and snippets.

@hisasann
Created July 4, 2014 05:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hisasann/facb425133b2db459865 to your computer and use it in GitHub Desktop.
Save hisasann/facb425133b2db459865 to your computer and use it in GitHub Desktop.
thisがarguments.calleの作用で変化してしまう
var global = this;
(function (b) {
if (b) {
console.log(global === this, '1'); // true
arguments.callee();
return;
}
console.log(this[0]); // true
console.log(global === this, '2'); // thisが変化してfalse
})(true);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment