How to flatten a javascript array using flatMap #shorts

preview_player
Показать описание
sharing a useful method to flatten an array of nested array

------------

Рекомендации по теме
Комментарии
Автор

This is great to know, but should also consider depth of the map. For example if you have further nester arrays, it will hoist the nested array up 1 level, but it doesn't drill down and bring everything to the parent most array.

abdulamite
Автор

That's nice. I saw a video actually using this 2 combine 2 separate arrays. They had an array of card values and an array of suits. The flatmap allowed him to generate 1 array with 52 cards.

zakuguriin
Автор

We can also use Array.flat() instead in this case

kabiskac
Автор

Nice 👍 I going a subscribe your channel 😊

yalgaar
Автор

What is this editor and what is the extension that show errors ?

web_hub
Автор

I’m new to coding. When would I need to use a nested array? Any real world examples?

riceball
Автор

I like how your linting gives exact errors. I want to know what settings you have used for eslint, or is it a different linter?

DARSHAN
Автор

Hi sir, what extension do you use to show that error message when typing?

phyothihakyaw
Автор

Does it work with arrays of objects of recursive type? I.e
interface testArr = {
label: string,
children: testArr[]
}

theseangle
Автор

What plug-in are you using that tells you the errors in your code.

Furryfluff