Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
find and set the globalObject in JavaScript
"use strict";
var globalScope;
try {
globalScope = Function('return this')();
//extend else-if cases for other globalObject-names as needed...
if(this && this.hasOwnProperty && this.hasOwnProperty('window')){
globalScope = window;
throw 'globalScope not found';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.