ES2019. Aplanar arrays en Javascript con Array.flat()

“Flatten arrays” gracias a ES2019

Image for post
Image for post

¿Pero qué es eso de aplanar?

Image for post
Image for post

Posibles implementaciones de flatArray()

const merged = [].concat.apply([], arrays);
const myArray = [['📦', '📦'], ['📦', ['📦', ['📦']]]];
Image for post
Image for post

Aplanar arrays en ES2019

Image for post
Image for post

¿Cómo funciona?

Image for post
Image for post
Image for post
Image for post
Image for post
Image for post

¿Quieres recibir más artículos como este?

Entre paseo y paseo con Simba desarrollo en Symfony y React

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store