Array flat() method in JavaScript! - New in Chrome Update 69

preview_player
Показать описание

In this video we take a look at the flat() method in action, with an example of it's basic usage and also with it's single optional parameter, depth.

Support me on Patreon:

For your reference, check this out:

Follow me on Twitter @dcode!

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
Рекомендации по теме
Комментарии
Автор

This is method is so innovative that NodeJS in my terminal can't recognize it 😂
There is an alternative for this example if you (let's say) know all the numbers in arrays:

let newNumbers = [1, 2, 3, ...[4, 5, 6, ...[7, 8, 9]]]; // spread
console.log(newNumbers); // outputs [1, 2, 3, 4, 5, 6, 7, 8, 9]

Mirzly