Skip to content

Instantly share code, notes, and snippets.

@JohnMGant
Created August 7, 2020 17:38
Show Gist options
  • Select an option

  • Save JohnMGant/58c83acab400222d5353f28586568995 to your computer and use it in GitHub Desktop.

Select an option

Save JohnMGant/58c83acab400222d5353f28586568995 to your computer and use it in GitHub Desktop.
Add an array of integers in JavaScript using array.forEach
function Add(values) {
let sum = 0
values.forEach(val => sum += val)
return sum
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment