Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sum all values of an array

 function array(arr){
   var sum = 0;
   for (var i = 0; i< arr.length; i++){
    sum += arr[i];
   }
   console.log(sum);
 }
 array([5, 1, 3, 3])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sum #values #array
ADD COMMENT
Topic
Name
2+2 =