// 1、合并数组 let arr1 = [1,2,3]; let arr2 = [4,5] let arr3 = [...arr1,...arr2]; console.log(arr3); //[1, 2, 3, 4, 5] console.log([...arr1,...arr2]);//[1, 2, 3, 4, 5] let arrA = [1,2,3]; let arrB = [4,5,...arrA]; let arrC = [...arrA,4,5]; console.log(arrB,arrC); // [4, 5, 1, 2, 3] [1, 2, 3, 4, 5] // 2、合并对象 let obj = { a:1,b:2 }; let obj2 = { ...obj }; console.log(obj2) //{ a: 1, b: 2 } console.log(obj == obj2) //3、函数传值 function fn(a,b,c){ console.log(a) console.log(b) console.log(c) } let arr = [1,2,3]; //ES6 fn(...arr); // 4、配合解构使用 let [a,...arr11] = [1,2,3,4,5]; console.log(a); //1 console.log(arr11) //[ 2, 3, 4, 5 ] let {a,...obj} = {a:1, b:"1", c:function(){}, d:null, e:undefined, e:Symbol}; console.log(a); //1 console.log(obj); //{ b: '1', c: [Function: c], d: null, e: [Function: Symbol] }