14 Star 81 Fork 23

北京大学-张齐勋 / 移动端开发入门实践

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
ES6_箭头函数.md 412 Bytes
一键复制 编辑 原始数据 按行查看 历史
张齐勋 提交于 2021-02-25 09:56 . update

ES6标准新增了一种新的函数:Arrow Function(箭头函数)

x => x * x

相当于

function (x) {
    return x * x;
}

标准函数写法

const arr = [1,2,3]

arr.map(function(item){
    return item+1;
})

箭头函数标准写法

const arr = [1,2,3]
arr.map((item) =>{
    return item+1;
})

箭头函数简写方法

const arr = [1,2,3]
arr.map(item => item+1 )
JavaScript
1
https://gitee.com/ss-pku/webdev.git
git@gitee.com:ss-pku/webdev.git
ss-pku
webdev
移动端开发入门实践
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891