Re: [JSMentors] Re: global object property access

2011-02-05 Thread Garrett Smith
On 2/4/11, mcot atm1...@gmail.com wrote: Hi. I am still reading up on this but here are some more tests I have run: console.log(typeof(foo) === 'undefined'); // true -- doesn't raise reference error. foo; // reference error

[JSMentors] Re: global object property access

2011-02-04 Thread Angus Croll
http://javascriptweblog.wordpress.com/2010/08/16/understanding-undefined-and-preventing-referenceerrors/ On Feb 4, 4:16 pm, Jason Persampieri ja...@persampieri.net wrote: On Fri, Feb 4, 2011 at 4:07 PM, Michael Geary m...@mg.to wrote: The first two cases are identical to each other, because

[JSMentors] Re: global object property access

2011-02-04 Thread mcot
Hi. I am still reading up on this but here are some more tests I have run: console.log(typeof(foo) === 'undefined'); // true -- doesn't raise reference error. foo;// reference error even without the call to console.log -- To

[JSMentors] Re: global object property access

2011-02-04 Thread mcot
By the way I am running these tests in the spidermonkey shell and in chrome using the dev tools. I substitute console.log for print() in the spidermonkey shell. On Feb 4, 10:54 pm, mcot atm1...@gmail.com wrote: Hi.  I am still reading up on this but here are some more tests I have run:

Re: [JSMentors] Re: global object property access

2011-02-04 Thread Michael Geary
Yes, that's correct. The typeof operator does not require its operand to be defined. When its operand is not defined, typeof returns the string 'undefined'. All correct, expected behavior. On Fri, Feb 4, 2011 at 7:54 PM, mcot atm1...@gmail.com wrote: Hi. I am still reading up on this but here

Re: [JSMentors] Re: global object property access

2011-02-04 Thread Juriy Zaytsev
On Fri, Feb 4, 2011 at 10:54 PM, mcot atm1...@gmail.com wrote: Hi. I am still reading up on this but here are some more tests I have run: console.log(typeof(foo) === 'undefined'); // true -- doesn't raise reference error. foo;