Is there a C#-like lambda syntax in JavaScript?

后端 未结 6 668
生来不讨喜
生来不讨喜 2020-12-02 12:13

Is there a framework or post processor for JavaScript that supports lambda syntax like in C#?

Function definitions in CoffeeScript seem to look like lambdas but I ha

6条回答
  •  旧时难觅i
    2020-12-02 12:24

    You could use typescript (www.typescriptlang.org/):

    function (d, i) {
        return "translate(" + d.x + "," + d.y + ")";
    }
    

    would become

    (d, i) =>  "translate(" + d.x + "," + d.y + ")"  
    

    and much more cool stuff, like typing: ... that's if you are into that

提交回复
热议问题