当前位置:网站首页>Curry realization of function continuous call calculation and accumulation
Curry realization of function continuous call calculation and accumulation
2022-04-23 06:53:00 【zjLOVEcyj】
function curry(...args) {
let parmas = args
function sum() {
parmas = [...parmas, ...arguments]
return sum
}
sum.toString = function () {
return parmas.reduce((prev, cur) => {
return prev + cur
})
}
return sum
}
console.log(curry(1)(2)(3)(10)(10, 20).toString())
Front end classic interview questions
Coriolis function A function that will add up sum(a,b,c,d) Into something that can be called indefinitely sum(a)(b)(d)…
版权声明
本文为[zjLOVEcyj]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230555334231.html
边栏推荐
- TP6 的 each 遍历用法
- PHP background parsing after JQ serialization
- js中entries(),keys(),values() , some(), Object.assign()遍历数组用法
- 1-3 组件与模块
- Navicat 连接 oracle library is not loaded的解决方法
- Overview of node file system and buffer
- Set and map
- freeCodeCamp----prob_calculator练习
- .Net Core 下使用 Quartz —— 【7】作业和触发器之简单触发器
- The difference between VaR, let and Const
猜你喜欢
随机推荐
New type of dark energy could solve Universe expansion mystery
出入库与库存系统的模型问题
fdfs启动
Offset et client pour obtenir des informations sur l'emplacement des éléments Dom
端口占用1
mysql密码过期的方法
JS handwriting compatibility event binding
PHP unlimited classification and tree
Leak detection and filling (I)
sql中的 IF 条件语句的用法
Method of MySQL password expiration
el-cascader和el-select点击别处让下拉框消失
【批量更改mysql表以及表中字段对应的编码】
Color string conversion
深入理解控制反转和依赖注入
swiper组件封装
Leak detection and vacancy filling (IV)
模仿扇贝短文阅读页面
JS手写兼容性事件绑定
.Net Core3.1 使用 RazorEngine.NetCore 制作实体生成器 (MVC网页版)