Hi, My personal preference for optional arguments goes to:
optArg = optArg !== 'undefined' ? optArg : defaultValue; Which would be a line entered at the top of the function block for each of the optional arguments, which with my current understanding of the compiler innards seems like something that I should be able to implement. One node -> one line. I like your solution for the ... parameter: rest = Array.prototype.slice.call(arguments, numberOfOtherArguments); As a 'one liner', it neatly fits with my vey limited understanding of the compiler innards ;-) Thank you! EdB On Sat, Dec 22, 2012 at 10:42 PM, Frank Wienberg <fr...@jangaroo.net> wrote: > On Sat, Dec 22, 2012 at 6:46 PM, Erik de Bruin <e...@ixsoftware.nl> wrote: > >> default value (if present). I figured out how to handle >> that in JS >> > > Hi Erik, > > just so that you do not run into a minor fallacy Bernd Paradies went into > in FalconJS: did you have a look at my blog post tackling exactly that > feature, default parameter values: > http://blog.jangaroo.net/2012/01/simulating-actionscript-parameter.html > And while you're at it, what about implementing the "..." rest parameter > next? > http://blog.jangaroo.net/2012/01/simulating-actionscript-rest-parameter.html > You see, it's my obsession, too... ;-) > > Best, > -Frank- -- Ix Multimedia Software Jan Luykenstraat 27 3521 VB Utrecht T. 06-51952295 I. www.ixsoftware.nl