对象扩展运算符和rest运算符
2018-01-30 21:26
239 查看
对象扩展运算符
实例1:
![](https://img-blog.csdn.net/20180129205425460?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvempzZmR4/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
实例2:
![](https://img-blog.csdn.net/20180129210018377?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvempzZmR4/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
rest运算符
实例1:
![](https://img-blog.csdn.net/20180129210357912?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvempzZmR4/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
实例2:
实例1:
function f(...arg){ console.log(arg[0]); console.log(arg[1]); console.log(arg[2]); console.log(arg[3]); } f(1,2,3);
实例2:
let arr1 = ['www','qxb','com']; let arr2 = [...arr1]; console.log(arr2); arr2.push('ljj'); console.log(arr2); console.log(arr1);
rest运算符
实例1:
function f(first,...arg){ console.log(arg.length); } f(0,1,2,3,4,5,6,7);
实例2:
function f(first,...arg){ for(let val of arg){ console.log(val); } } f(0,1,2,3,4,5,6,7);
相关文章推荐
- ES6---扩展运算符和rest‘...’(三点运算符),在数组、函数、set/map等中的应用
- ES6 rest参数和扩展运算符
- ES6---扩展运算符和rest‘...’(三点运算符),在数组、函数、set/map等中的应用
- es6扩展运算符,rest运算符,箭头函数,
- rest 参数和扩展运算符
- ArcGIS 服务对象扩展(SOE)新手自学笔记(2):REST SOE模板上
- es6 javascript对象的扩展运算符
- es6中的解构赋值、扩展运算符和rest参数使用详解
- ES6-rest参数和扩展运算符
- es6 学习笔记 之 扩展运算符 和 rest运算符
- ES6 rest参数和扩展运算符
- ES6 rest与扩展运算符
- ES6-对象的扩展-对象的扩展运算符
- ES6(六: 函数扩展)(默认值,rest参数,扩展运算符)
- 扩展运算符(...) 合并 对象
- ES6学习之路3----rest参数与扩展运算符
- rest 参数与扩展运算符
- ArcGIS 服务对象扩展(SOE)新手自学笔记(3):REST SOE模板下
- JavaScript ...运算符(扩展运算符)以及rest运算符介绍
- ES6中的rest参数与扩展运算符详解