Created
October 6, 2020 00:16
-
-
Save lai32290/1402336d8acce5b94fa68efff8b8c519 to your computer and use it in GitHub Desktop.
Medium - Montando seu lanche com Reduce 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const matriz = [ [1, 2, 3], [4, 5, 6], [7, 8, 9] ]; | |
const valorInicial = []; | |
const vetor = matriz.reduce(function achatar(resultadoAnterior, lista) { | |
return [ ...resultadoAnterior, ...lista ]; | |
}, valorInicial); | |
console.log(vetor); | |
// [1, 2, 3, 4, 5, 6, 7, 8, 9] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment