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

后端 未结 6 662
生来不讨喜
生来不讨喜 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条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-02 12:25

    Javascript has very nice anonymous functions that allows you to create lambdas anyWhere you need as a function but the implementation comes with some much words and scope creation repeating:

    function(name){
         return "Hello, " + name;
    }
    

    Thanks to EcmaScript 2015 lambda expresion is now available for javaScript with simpler syntax as Arrow Function

    (name) => "Hello, " + name
    

提交回复
热议问题