ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
1.展开一个数组 ``` var arr = [1,2,3]; console.log(...arr); //1 2 3 ``` 2.连接数组 ``` var arr4 = [1,2,3]; var arr5 = [4,5,6] console.log([...arr4,...arr5]); // [1, 2, 3, 4, 5, 6] ``` 3.合并对象 ``` let ajaxData = {name:'xiaoming',age: 18}; let person = {...ajaxData, name: 'jack', adress:'earth' } console.log(person) //{name: 'jack', age: 18, adress: 'earth'} ``` 4.浅复制一个对象 ``` let ajaxData = {name:'xiaoming',age: 18}; let reactPropsAPI = {...ajaxData}; console.log(...ajaxData) // 报错: 展开运算符不能展开对象 let {name, age} = reactPropsAPI; ```