Function.length and Default Parameters

Rick Waldron waldron.rick at gmail.com
Fri Oct 12 06:11:47 PDT 2012




On Thursday, October 11, 2012 at 11:25 PM, Kevin Smith wrote:

>  
> > And specifically not stopping counting at the first parameter with a default value, right?
>  
> Yep.  Would it also work for this use case to stop counting at the first parameter with no default value, after which there are only defaults?  
>  
>     function f(a, b = 2, c, d = 4, ...rest) {}
>     f.length === 3;
>  
> Probably? Not sure...

Neither am I...

This looks like the sort of thing that will get labeled "uselessly unreliable", then again I was in favor of making length equal the number of formal parameters—rest included.

Rick  
>  
> Kevin  
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>  
>  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20121012/ed76f1cc/attachment-0001.html>


More information about the es-discuss mailing list