Re: How can I call variable in script like this global.var

Boris Zbarsky <[email protected]> Mon, 1 Apr 2019 12:36:27 -0400
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <[email protected]>
On 4/1/19 12:21 PM, muhammad sami wrote:
>      Thanks for quick response. I'm using spidermonkey 45. can I rename the global object as in v8.

You can do:

   run(cx, e.dialog, "var global = this;");

if you want to just stick a reference to the global in the variable 
named "global".  If that's evaluated in global scope it will end up with 
the global stored in the variable.

> I have tried
>                     run(cx, e.dialog, "globalThis.x");

Right, that won't work in SpiderMonkey 45.  Like I said in my previous 
mail, it needs SpiderMonkey 55 or later.

-Boris