Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@leandromoreira
Created April 27, 2016 03:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leandromoreira/75b39ee36e563b9175683427409bbae3 to your computer and use it in GitHub Desktop.
Save leandromoreira/75b39ee36e563b9175683427409bbae3 to your computer and use it in GitHub Desktop.
// brief explanation of what happens here
var sumCharsOnList = compose(sum, lenght, toUpperCase)
sumCharsOnList(["NX", "PS4", "XboxOne"])
// --> first the list ["NX", "PS4", "XboxOne"] is passed to the function toUpperCase
// --> toUpperCase returns another list and it's the input for the lenght function
// --> the lenght function return a list of integers which will become the input for sum function
// --> sum function will reduce the list summing all the integers and returning the sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment