On Dec 19, 2010, at 2:17 AM, Garrett Smith wrote: > On 12/18/10, Juriy Zaytsev <kan...@gmail.com> wrote: >> On Sun, Dec 19, 2010 at 2:02 AM, Garrett Smith >> <dhtmlkitc...@gmail.com>wrote: >> >>> On 12/18/10, Ezequiel <ezequ...@ziggyism.com> wrote: >>>> On Dec 17, 2:37 am, Juriy Zaytsev <kan...@gmail.com> wrote: >>>>> var beget = (function() { >>>>> function F(){ }; >>>>> return function(o) { >>>>> F.prototype = o; >>>>> return new F; >>>>> }; >>>>> >>>>> })(); >>>>> >>>> >>>>> return new F; >>>> >>>> Are there any penalties for not including the parentheses when you're >>>> invoking a constructor? >>>> >>>> ie. new F; versus new F(); >>>> >>> >>> It is the `new` operator, not `Arguments`, that makes it a New Expression. >>> >>> More is explained here (thread tip: ignore troll response): >>> < >>> https://groups.google.com/group/comp.lang.javascript/browse_thread/thread/6bb13a70aa769e17/ce53a37da77d354b#ce53a37da77d354b >>>> >> >> >> | Parenthesis is either `Arguments` or as Grouping Operator, depending on >> | the context in which it appears. When parenthesis appear to the right of >> | a MemeberExpression, then a CallExpression is formed. [...] >> >> ..or to the right of another CallExpression: > > Ah, that's right.
parenthesis are for function calling not for arguments, arguments object is created either you passed arguments or no. the new operator is the one that triggers the object creation process, but for consistency i would recommend to put the parenthesis, because in the end the function will get called. > -- > Garrett > > -- > To view archived discussions from the original JSMentors Mailman list: > 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 unsubscribe from this group, send email to > jsmentors+unsubscr...@googlegroups.com -- To view archived discussions from the original JSMentors Mailman list: 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 unsubscribe from this group, send email to jsmentors+unsubscr...@googlegroups.com