// 1. Test objects destructuring assignment const object1 = {A1: ' A1 ' , B1: ' B1 ' }; const {A1, B1, C1} = object1; the console.log (A1, B1, C1); // 2 test array destructuring assignment const arr2 is = [ ' A2 ' , ' B2 ' ]; const [A2, B2, C2] = arr2 is; the console.log (A2, B2, C2); // 3. destructuring assignment function test - mass Object const object3 {A3 =: ' A3 ' , B3: ' B3 ' }; the this .testObject (object3); // 4. destructuring assignment function test - pass array const arr4 = [ ' A4 ' , ' B4 ' ]; the this .testArray (arr4); // 5. The test destructuring assignment function - the object and pass adding a new attribute const object5 = {A5: ' A5 ' , B5: ' B5 ' }; the this .testObjectAdd (object5); the console.log ( ' object5 ' , object5); // 6. The test destructuring assignment function - transfer array and Push const arr6 = [ ' A6 ' ,'b6']; this.testArrayPush(arr6); console.log('arr6', arr6);
testObject({a3, b3, c3='c3'}){ console.log(a3, b3, c3); }, testArray([a4, b4, c4='c4']){ console.log(a4, b4, c4); }, testObjectAdd(object5){ Object.assign(object5, {c5:'c5'}); }, testArrayPush(arr6){ arr6.push('c6'); },