Re: [JSMentors] Re: "void" function ?

2011-01-13 Thread Marc Harter
IMO, any 'undefined' variable will do, as long as you know its in scope. void is kinda ugly to me, probably damage from all the http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google archive, visit here: http://www.mail-archive.com/jsmentors@googlegroups.com/ To unsubsc

Re: [JSMentors] Re: "void" function ?

2011-01-13 Thread Miller Medeiros
another approach is to create a function that checks if the param is undefined and store a reference to it on to the local scope for brevity.. in many cases it will be clearer (specially if you have multiple calls).. function isDef(param){ //return typeof param !== 'undefined'; //if you prefer n

[JSMentors] Re: "void" function ?

2011-01-13 Thread Jorge
On Jan 12, 4:06 pm, Peter van der Zee wrote: > For a detailed concrete parse tree see: > > http://esparser.qfox.nl/#runnow:on,code:void-0 > > (hover mouse to see name of each node) Awesome! -- Jorge. -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-arch

Re: [JSMentors] Re: "void" function ?

2011-01-12 Thread Peter van der Zee
For a detailed concrete parse tree see: http://esparser.qfox.nl/#runnow:on,code:void-0 (hover mouse to see name of each node) - peter -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/jsmentors@jsmentors.com/ To search via a non-Google arch

Re: [JSMentors] Re: "void" function ?

2011-01-12 Thread Juriy Zaytsev
On Wed, Jan 12, 2011 at 4:25 AM, Peter van der Zee wrote: > On Wed, Jan 12, 2011 at 7:07 AM, Nicholas C. Zakas > wrote: > >> ?To be more precise void is an operator, just typeof. The parentheses are >> optional, just like you can write -1 or -(1), the same is true for void(0) >> or void 0, altho

[JSMentors] Re: "void" function ?

2011-01-12 Thread Jorge
On Jan 12, 10:25 am, Peter van der Zee wrote: > On Wed, Jan 12, 2011 at 7:07 AM, Nicholas C. Zakas > wrote: > > > ?To be more precise void is an operator, just typeof. The parentheses are > > optional, just like you can write -1 or -(1), the same is true for void(0) > > or void 0, although white s

Re: [JSMentors] Re: "void" function ?

2011-01-12 Thread Peter van der Zee
On Wed, Jan 12, 2011 at 7:07 AM, Nicholas C. Zakas wrote: > ?To be more precise void is an operator, just typeof. The parentheses are > optional, just like you can write -1 or -(1), the same is true for void(0) > or void 0, although white space is required when parentheses aren't there > for void

Re: [JSMentors] Re: "void" function ?

2011-01-11 Thread Nicholas C. Zakas
holas _ Nicholas C. Zakas Twitter: @slicknet Blog: http://www.nczonline.net/ -Original Message- From: Michael Haufe (TNO) Sent: Monday, January 10, 2011 12:41 PM To: The JSMentors JavaScript Discussion Group Subject: [JSMentors] Re: "void" function ? On Jan 10,

[JSMentors] Re: "void" function ?

2011-01-10 Thread Michael Haufe (TNO)
On Jan 10, 11:48 am, Fran wrote: > Hi there, > > I have a couple question: > > Why does "void(any_input)" return "undefined" ? Because void is an operator that always returns undefined for any valid input > Why does "typeof void" throw an exception ? Because void needs an argument. void is not

Re: [JSMentors] Re: "void" function ?

2011-01-10 Thread Peter van der Zee
On Mon, Jan 10, 2011 at 7:07 PM, Angus Croll wrote: > >>It has no decent practical use I can think of. > > The only place I use it is when I want to test something in the urlbar of the browser. If it returns anything at all, it'll navigate to the result. So to prevent that, I `javascript:void(ex

[JSMentors] Re: "void" function ?

2011-01-10 Thread Angus Croll
>>It has no decent practical use I can think of. It allows you to evaluate an expression but not be beholden to its return value - this is occasionally useful for conditional operations. See this reply by Brendan Eich himself to one of my blog posts :-) http://javascriptweblog.wordpress.com/2010