Skip to content

Instantly share code, notes, and snippets.

@micahasmith
Created December 29, 2011 00:35
Show Gist options
  • Save micahasmith/1530738 to your computer and use it in GitHub Desktop.
Save micahasmith/1530738 to your computer and use it in GitHub Desktop.
sum items in an array
var sum=function(list) {
var len=list.length,
sum=0,
i=0;
for(;i<len;i+=1) {
sum+=list[i];
}
return sum;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment