On 10 January 2011 17:48, Fran <[email protected]> wrote: > Hi there, > > I have a couple question: > > Why does "void(any_input)" return "undefined" ? > Why does "typeof void" throw an exception ? > What is "void" for or what use can I give to it ? > > I'm quite curious about this reserved word and I'd like to know more about > it and if it has any interesting use. > > Thanks in advance.
1. `void` is a unary operator. It is defined to return `undefined`, regardless of operand. 2. `void` is an operator and therefore not a valid operand for the `typeof` operator. 3. See 1. It has no decent practical use I can think of. Tim -- 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]
