箭头函数(Arrow Functions)

ES5语法:

var getPrice = function() {
    return 4.55;
};
console.log(getPrice());

 

ES6 中,箭头函数就是函数的一种简写形式,使用括号包裹参数,跟随一个 =>,紧接着是函数体:

var getPrice = () => 4.55;
console.log(getPrice());

 

posted @ 2019-04-09 10:44  随★风  阅读(232)  评论(0编辑  收藏  举报