I wish to create a Javascript object with nested variables where some of the variables will not have a default value specified.
I currently have this:
va
You will want the undefined
primitive value to be the default value:
var myObject = {
GlobalVars: {
globalVarA: "foo",
globalVarB: "bar",
globalVarC: void 0
},
myFunction: function(){
//do something
}
}
The void 0
expression gives the value of undefined
, regardless of whether undefined
was "rerouted".