Let's say I got a global variable called myData. It was declared as myData = 1;
at the beginning of a script.
Goal:
I want to create a single module that will not have access this myData
in any way. myData
must remain global in other modules.
Note: Yes, I already do know that I could require myData
in every page where I need it but that's not what I'm looking for.
Attempts:
To do that, at the very beginning of the module, I wrote: var myData;
. The module could no longer access myData
directly by myData
.
Problem: You can still access it via GLOBAL.myData
So I instead, I wrote var myData, GLOBAL;
at the beginning of the module.
Are there any other ways someone could access myData
? If so, how could I prevent it?