The Now Platform® Washington DC release is live. Watch now!
In JavaScript, "undefined" means two distinctly different things:
var x = {};
x.s = 'cowabunga';
x.t = undefined;
gs.log('Typeof...');
gs.log('x.s: ' + typeof x.s);
gs.log('x.t: ' + typeof x.t);
gs.log('x.y: ' + typeof x.y);
gs.log('');
gs.log('Direct reading...');
gs.log('x.s: ' + x.s);
gs.log('x.t: ' + x.t);
gs.log('x.y: ' + x.y);
gs.log('');
gs.log('Enumeration...');
for (var n in x)
gs.log('x.' + n + ': ' + x[n]);
Typeof...
x.s: string
x.t: undefined
x.y: undefined
Direct reading...
x.s: cowabunga
x.t: undefined
x.y: undefined
Enumeration...
x.s: cowabunga
x.t: undefined
var x = undefined;
gs.log('x: ' + x);
gs.log('y: ' + y);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.