Last active
March 9, 2020 17:12
-
-
Save yickson/1b14e3e434e939b04c5408189d4933ad to your computer and use it in GitHub Desktop.
Función que suma un arreglo y retorna una funcion que recibe la sumatorio del arreglo inicial
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 miArray = [1, 2, 3, 4, 5]; | |
const sum = (arrayInt) => { | |
return arrayInt.reduce((accum , current) => (accum + current), 0); | |
} | |
const suma = (arr2) => (func) => (func(sum(arr2))); | |
// Ejemplo de uso | |
suma(miArray) ( | |
resultado => console.log(resultado) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment