Skip to content

Instantly share code, notes, and snippets.

@sktwentysix
Created June 9, 2022 12:17
Show Gist options
  • Save sktwentysix/3b5d8f9ed63d65ea88c03a2fa621a98d to your computer and use it in GitHub Desktop.
Save sktwentysix/3b5d8f9ed63d65ea88c03a2fa621a98d to your computer and use it in GitHub Desktop.
const array = [1,5,3,9,6,2,4]
const reducerCallback = (prevItem, currItem) => {
return prevItem + currItem
}
console.log(array.reduce(reducerCallback)) // 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment