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

Boris Zbarsky <[email protected]> Mon, 1 Apr 2019 12:03:49 -0400
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <[email protected]>
On 4/1/19 11:41 AM, muhammad sami wrote:
> noname:1:ReferenceError: global is not defined

Right, because you never defined it.  You could do:

   run(cx, e.dialog, "x");

or

   run(cx, e.dialog, "this.x");

depending on the semantics you want.  Or if you have a new enough 
SpiderMonkey (corresponding to Gecko 65 or later):

   run(cx, e.dialog, "globalThis.x");

-Boris