Skip to content

Commit e50be98

Browse files
homework_5 supper2
1 parent 5c2bbca commit e50be98

File tree

1 file changed

+15
-1
lines changed
  • js-core/homeworks/homework-5/src

1 file changed

+15
-1
lines changed

js-core/homeworks/homework-5/src/main.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,18 @@ task1(arr, 55);
173173

174174
//@SUPER 1
175175

176-
//@SUPER 2
176+
//@SUPER 2
177+
178+
let firstArray1 = [25,10,[10,[15]]];
179+
180+
function changeArr(arr) {
181+
if (Array.isArray(arr)) {
182+
return arr.reduce(function(done,curr){
183+
return done.concat(changeArr(curr));
184+
}, []);
185+
} else {
186+
return arr;
187+
};
188+
};
189+
190+
console.log(changeArr(firstArray1));

0 commit comments

Comments
 (0)