Hey JR
He didn't say If (foo) { } is the same as if (foo !== 'undefined') { }
He said If (foo) { } is the same as if (foo != 0) { }
( page 121 of The Good Parts)
The former case uses toBoolean the latter uses toPrimitive
therefore:
var foo = [0];
console.log(foo ? true : false) //true
console.log(foo != 0 ? true : false) //fal
cheers
Angus
--
To view archived discussions from the original JSMentors Mailman list:
http://www.mail-archive.com/[email protected]/
To search via a non-Google archive, visit here:
http://www.mail-archive.com/[email protected]/
To unsubscribe from this group, send email to
[email protected]