Skip to content

Instantly share code, notes, and snippets.

@sattybhens
Created July 12, 2011 20:10
Show Gist options
  • Select an option

  • Save sattybhens/1078860 to your computer and use it in GitHub Desktop.

Select an option

Save sattybhens/1078860 to your computer and use it in GitHub Desktop.
sum consecutive numbers in an array
value = 0
result = [100, -20, -20, 50, 70].map((e, i) ->
value += e
).shift()
console.log result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment