Created
October 6, 2020 00:13
-
-
Save lai32290/75466c625d6f1b7a12eb6833c8bf3beb to your computer and use it in GitHub Desktop.
Medium - Montando seu lanche com Reduce 1
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 ingredientes = [ 'pao', 'tomate', 'queijo', 'ovo frito', 'ketchup', 'mostarda', 'pao' ]; | |
const lanche = ingredientes.reduce(function juntarComPao(resultadoAnterior, ingrediente) { | |
return `${resultadoAnterior}, ${ingrediente}`; | |
}); | |
console.log(`Aqui está o seu lanche: ${lanche}`); | |
// Aqui está o seu lanche: , pao, tomate, queijo, ovo frito, ketchup, mostarda, pao |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment