Re: How can I call variable in script like this global.var
muhammad sami <[email protected]> Mon, 1 Apr 2019 09:58:13 -0700 (PDT)
| Newsgroups | gmane.comp.mozilla.devel.jseng |
|---|---|
| Message-ID | <[email protected]> |
> 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 your idea it's working but it's doesn't fully serve mu main goal which is scoping that's what I did I ran this script over global 'var x = 5 ; var global = this; global.x' works perfectly, the I created another global object which has global as a prototype I ran this script over child object 'var x = 10 ; var child = this; child.x' but x=child.x=global.x which totally make scence as child=global=this I want the global.x still the same without change any idea how can I do it.