Created
October 6, 2020 00:14
-
-
Save lai32290/f3e40fe3462163f43eb118c36dd02784 to your computer and use it in GitHub Desktop.
Medium - Montando seu lanche com Reduce 2
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}`; | |
}, 'prato'); | |
console.log(`Aqui está o seu lanche: ${lanche}`); | |
// Aqui está o seu lanche: prato, 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