Rest parameter syntax

Rick Waldron waldron.rick at gmail.com
Tue Jun 12 08:26:51 PDT 2012


On Tue, Jun 12, 2012 at 10:38 AM, Felix Böhm <esdiscuss at feedic.com> wrote:

> Per definition, rest parameters always need to be at the end of a
> FormalParameterList. I was wondering if this limitation could be liftet.
>

Consider:


function foo( a, b, ...others, c ) {
  return [ a, b, others, c ];
}


foo( 1, 2, 3, 4, 5, 6, 7, 8, 9 );


  a  b  others
[ 1, 2, [ 3, 4, 5, 6, 7, 8, 9 ] ]


How do you resolve where to stop claiming arguments as items in the rest
param "others"?


Rick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120612/76cf360a/attachment.html>


More information about the es-discuss mailing list