Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@hirak
Created May 4, 2012 05:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hirak/2592226 to your computer and use it in GitHub Desktop.
Save hirak/2592226 to your computer and use it in GitHub Desktop.
globalオブジェクトを取得する ref: http://qiita.com/items/d249a2f2f13532748324
var global = this;
var global = (function(){return this})();
var e = eval, global = e("this");
//↓余計な変数を増やさない書き方
var global = ("global",eval)("this");
var global = new Function("return this")();
//newは省略可
var global = Function("return this")();
"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