Hi all,

I'm trying to create a global object to contain all my variables. I want to place a check to see whether my global variable name is taken. Like so:

if( typeof globalVar == "undefined"){
   globalVar = {};
    // Check if 'globalVar1' is defined and then keep iterating.
If 'globalVar' is defined, check whether 'globalVar1' is defined. So, as you can see there are two questions from me.

1) How do I check at runtime whether the variable 'globalVar1' exist?
2) Even if the variable 'globalVar1' exist, how would I update the rest of my code to use the newly created 'globalVar1' global obj?

Please help