jobbet litt med higher order functions

This commit is contained in:
Geir Okkenhaug Jerstad 2024-09-24 09:02:45 +02:00
parent 9835ea4471
commit b0523a9210
2 changed files with 17 additions and 0 deletions

View file

@ -0,0 +1,17 @@
let arrays = [[1,2,3], [4,5],[6,7]];
let newArray = [];
let newArray2 = arrays.flat();
for (let key in arrays) newArray = newArray.concat(arrays[key]);
// arrays.forEach((v) => {
// newArray.push(v);
// newArray.concat(v);
// })
// function reduceArrays(){
// for (array of arrays) {
// console.log(array,count)
// }
// }
//reduceArrays();
console.log(newArray2);