Skip to content

Commit 0fd38c8

Browse files
committedMay 24, 2021
Completed exercise 4.1
1 parent 634f02f commit 0fd38c8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
 
+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
let nestedArrays = [
2+
['a', 'b', 'c'],
3+
['d', 'e', 'f'],
4+
['g', 'h', 'i'],
5+
['j', 'k', 'l'],
6+
['m', 'n', 'o'],
7+
['p', 'q', 'r'],
8+
['s', 't', 'u'],
9+
['v', 'w', 'x'],
10+
['y', 'z', 'x'],
11+
];
12+
13+
function flatten(array) {
14+
let newArray = array.reduce((flat, item) => flat.concat(item), []);
15+
console.log(newArray);
16+
}
17+
18+
flatten(nestedArrays);

0 commit comments

Comments
 (0)