Re: [JSMentors] void function ?

2011-01-11 Thread Peter van der Zee
On Tue, Jan 11, 2011 at 8:35 AM, Adrian Olaru agol...@gmail.com wrote: or you just write undefined instead of void(0) or void 0. Minor fyi: While true, do note that in most cases, this incurs a (minor!) overhead for lookup (because undefined is actually a global variable) while void(0) is an

Re: [JSMentors] void function ?

2011-01-11 Thread Adrian Olaru
My point is that void(0) or void 0, is not (that) used in the real world. @peter, @matthias... I know that about undefined. It's a good info for others that don't know, though. On Tue, Jan 11, 2011 at 10:54 AM, Peter van der Zee qfo...@gmail.comwrote: On Tue, Jan 11, 2011 at 8:35 AM, Adrian

Re: [JSMentors] void function ?

2011-01-10 Thread Lasse Reichstein
On Mon, 10 Jan 2011 18:48:29 +0100, Fran m...@fran.ie wrote: Why does void(any_input) return undefined ? As others have said, it's the way it's defined. void is an operator that takes one operand and evaluates to undefined. Notice that the parentheses are not needed. void 2+4 works just as

Re: [JSMentors] void function ?

2011-01-10 Thread אריה גלזר
On Mon, Jan 10, 2011 at 8:05 PM, Dmitry Soshnikov dmitry.soshni...@gmail.com wrote: Though even this use-case is synthetic, since this check, first, can be replaced with checking typeof foo == undefined, and second -- in ES5 it's fixed, Well, writing void(0) is shorter and harder to