Skip to content

Instantly share code, notes, and snippets.

@Arieg419
Last active April 11, 2018 09:41
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Arieg419/bb66e8f28735aebae075ea4705a9957f to your computer and use it in GitHub Desktop.
Save Arieg419/bb66e8f28735aebae075ea4705a9957f to your computer and use it in GitHub Desktop.
// triple the value of every item in a given array
const triple = (arr) => arr.map((currentItem) => currentItem * 3)
// sum all the elements in a given array
const sum = (arr) => arr.reduce((prev, current) => prev + current, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment