(array, func)
| 32 | } |
| 33 | |
| 34 | function flatMap(array, func) { |
| 35 | const result = []; |
| 36 | for (const el of array) { |
| 37 | const mapped = func(el); |
| 38 | for (const innerEl of mapped) { |
| 39 | result.push(innerEl); |
| 40 | } |
| 41 | } |
| 42 | return result; |
| 43 | } |
| 44 | |
| 45 | function chunk(array, chunkSize) { |
| 46 | const result = []; |