会员
T恤
新闻
博问
闪存
赞助商
Chat2DB
所有博客
当前博客
我的博客
我的园子
账号设置
会员中心
简洁模式
...
退出登录
注册
登录
麦君
博客园
首页
新随笔
联系
订阅
管理
12 2018 档案
分别实现数组所有元素相加、相乘、相与——FP 风格
摘要:var ops = { "plus": (x,y)=>x+y, "mul" : (x,y)=>x*y, "and" : (x,y)=>x&y } function operation(op, array) { return array.slice(1).reduce(ops[op], array[0]); } operation("plus", array); opera...
阅读全文
posted @
2018-12-11 10:27
麦君
阅读(887)
评论(0)
推荐(0)
公告
点击右上角即可分享