repeated parameter names and default values

Andrea Giammarchi andrea.giammarchi at gmail.com
Thu Sep 27 09:31:53 PDT 2012


it would be stupid to code like that but it makes sense since it has
basically always been like that :)

function f(a) {
  // var a superflous ... still works
  var a, b = a, a = 3, c = a;
  return a+" "+b+" "+c;
}

On Thu, Sep 27, 2012 at 5:19 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>wrote:

> Consider
>
>    function f(a, b=a, a=3, c=a) {
>       return a+" "+b+" "+c
>    }
>
>    console.log(f(1));
>
> Based upon the conclusions about argument binding at the recent TC39
> meeting this will display:
>   "3 1 3"
>
> Any disagreement of this?
>
> Allen
> _______________________________________________
> 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/20120927/124b4ba4/attachment.html>


More information about the es-discuss mailing list