Created
May 4, 2012 05:22
-
-
Save hirak/2592226 to your computer and use it in GitHub Desktop.
globalオブジェクトを取得する ref: http://qiita.com/items/d249a2f2f13532748324
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 global = this; |
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 global = (function(){return this})(); |
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 e = eval, global = e("this"); | |
//↓余計な変数を増やさない書き方 | |
var global = ("global",eval)("this"); |
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 global = new Function("return this")(); | |
//newは省略可 | |
var global = Function("return this")(); |
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
"use strict"; | |
var global = (function(){return this})(); | |
console.log(global); //undefined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment