Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to find the sum of array using JavaScript

// If you do not want to use array.reduece you can itereate through the array and then get the solution.
const  getSum = (arr)=>{
  let sum = 0;
  for(key of arr){
    sum += key
  }
  return sum
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #find #sum #array #JavaScript
ADD COMMENT
Topic
Name
6+3 =