/ Published in: JavaScript
URL: http://jsfromhell.com/array/sum
Sum all the elements of a numeric array. Created: 2005.11.04
Expand |
Embed | Plain Text
/* ************************************** * sum Function v1.0 * * Autor: Carlos R. L. Rodrigues * ************************************** */ sum = function(o){ for(var s = 0, i = o.length; i; s += o[--i]); return s; };
You need to login to post a comment.
