-
//将剩余参数聚合成变元函数的单个参数 //ES6 > function f (x, y, ...a) { return (x + y) * a.length } f(1, 2, "hello", true, 7) === 9 true //ES5 > function f (x, y) { var a = Array.prototype.slice.call(arguments, 2); return (x + y) * a.length; }; f(1, 2, "hello", true, 7) === 9; true
友情链接:http://es6-features.org/#RestParameter
- rest语法总结全面>https://blog.csdn.net/zzxboy1/article/details/53691850
rest语法
猜你喜欢
转载自www.cnblogs.com/Longhua-0/p/9191834.html
今日推荐
周排行