Skip to content

Commit 29f4c2f

Browse files
authored
Merge pull request #6 from EasyCode-JavaScriptReact-v1/homework_5
homework_5 supper2
2 parents 2783c9d + e50be98 commit 29f4c2f

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)