当前位置:网站首页>ES6--residual parameters
ES6--residual parameters
2022-08-03 20:36:00 【Hey......】
Seven, remaining parameters (new syntax)
1. The rest parameter syntax allows us to represent an indefinite number of parameters as an array.
function fn(a, b, ...c){console.log(a); //1console.log(b); //2console.log(c); //[3,4,5]}fn(1,2,3,4,5);For example (to calculate the sum):
//Calculate andconst sum = (...args) => {let total = 0;args.forEach(item => total += item)return total;}console.log(sum(10,20)); //30console.log(sum(10,20,30)); //602, rest parameters and destructuring used together
let stu = ['Xiao Ming','Xiaohong','Xiao Zhang'];let [a1, ...a2] = stu;console.log(a1); //'Xiao Ming'console.log(a2); //['Xiaohong', 'Xiao Zhang']边栏推荐
猜你喜欢
随机推荐
独立站卖家在哪些平台做社交媒体营销效果最好?
关于shell脚本的一些思考
ES6 deconstruction assignment - array object deconstruction and deconstruction
leetcode 326. 3 的幂
若依集成easyexcel实现excel表格增强
Auto.js实现朋友圈自动点赞
直播源码开发,各种常见的广告形式
解决This application failed to start because no Qt platform plugin could be initialized的办法
RNA核糖核酸修饰Alexa 568/[email protected] 594/[email prote
华为设备配置VRRP负载分担
ThreadLocal详解
glusterfs build and use
leetcode 326. Powers of 3
李沐动手学深度学习V2-BERT微调和代码实现
系统运维系列 之CSV文件读取时内容中包含逗号的处理方法
不知道这4种缓存模式,敢说懂缓存吗?
RNA-ATTO 390|RNA-ATTO 425|RNA-ATTO 465|RNA-ATTO 488|RNA-ATTO 495|RNA-ATTO 520近红外荧光染料标记核糖核酸RNA
子树的大小
倒计时2天,“文化数字化战略新型基础设施暨文化艺术链生态建设发布会”启幕在即
双线性插值公式推导及Matlab实现









