Created
March 1, 2013 04:22
-
-
Save da-n/5062463 to your computer and use it in GitHub Desktop.
Sum of integer values in an array using jQuery. Credit: gion_13
Source: http://stackoverflow.com/a/8550489/695454
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$.sum_arr_int = function (arr) { | |
var r = 0; | |
$.each(arr, function (i, v) { | |
r += v; | |
}); | |
return r; | |
}; | |
var sum = $.sum_arr_int([20, 40, 80, 400]); | |
console.log(sum); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment