es6新语法arrow function

来源:互联网 发布:淘宝介入卖家没有发票 编辑:程序博客网 时间:2024/04/29 23:11

"Arrow function" 是ES6中的的新语法。


ES5:

var greeting = function(message, name){    return  message + name;}

ES6:

First thing in ES6, we can remove the function keyword and add => on the right side of the params:

var greeting = (message, name) => {   return message + name ;  }

Second, we can remove 'return' and {};

var greeting = (message, name) => message + name

 

举例TBD




0 0