Created
June 6, 2020 23:28
-
-
Save wescleymatos/e32d0b9150320edfb0e94d26700365cf to your computer and use it in GitHub Desktop.
Composição de funções JavaScript
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
function composicao(...funcoes) { | |
return function(valor) { | |
return funcoes.reduce((acc, fn) => { | |
return fn(acc); | |
}, valor); | |
}; | |
}; | |
//const composicao = (...funcoes) => valor => funcoes.reduce((acc, fn) => fn(acc), valor); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment