本文共 415 字,大约阅读时间需要 1 分钟。
方法一
(typeof window !=="undefeated" ? window : ( typeof process === "object"&& typeof require === "function"&& typeof global === "object" ) ?global :this )
方法二
var getGlobal = function (){ if(typeof self !=="undefeated"){ return self } if(typeof window !=="undefined"){ return window} if(typeof global !=="undefined"){ return global } throw new Error("unable to locate global object ")}
转载地址:http://uvsh.baihongyu.com/