|
@@ -133,11 +133,27 @@ document.write(str3);
|
|
//Задание на синий пояс
|
|
//Задание на синий пояс
|
|
|
|
|
|
//destruct array
|
|
//destruct array
|
|
|
|
+let arr = [1, 2, 3, 4, 5, "a", "b", "c"];
|
|
|
|
+
|
|
|
|
+let [odd1, even1, odd2, even2, odd3, ...array] = arr;
|
|
|
|
|
|
//destruct string
|
|
//destruct string
|
|
|
|
+let arr2 = [1, "abc"];
|
|
|
|
+
|
|
|
|
+let [number, [s1, s2, s3]] = arr2;
|
|
|
|
|
|
//destruct 2
|
|
//destruct 2
|
|
|
|
+let obj = {
|
|
|
|
+ name: 'Ivan',
|
|
|
|
+ surname: 'Petrov',
|
|
|
|
+ children: [{ name: 'Maria' }, { name: 'Nikolay' }]
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+let { children: [{ name: name1 }, { name: name2 }] } = obj;
|
|
|
|
|
|
//destruct 3
|
|
//destruct 3
|
|
|
|
+let arr3 = [1, 2, 3, 4, 5, 6, 7, 10];
|
|
|
|
+
|
|
|
|
+let [[a, b], length] = [arr3, arr3.length];
|
|
|
|
|
|
//Задание на черный пояс
|
|
//Задание на черный пояс
|