Answers for "shortcut to calculate sum of array in javascript"

1

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
}
Posted by: Guest on October-03-2021

Code answers related to "shortcut to calculate sum of array in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language