Answers for "calculate sum in javascript"

12

javascript sum of array

const sum = arr => arr.reduce((a, b) => a + b, 0);
Posted by: Guest on July-03-2020
2

javascript sum of numbers

var price1 = 5;
var price2 = 6;

var total = price1 + price2;
Posted by: Guest on July-28-2021
0

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
0

javascript sum of numbers

x = x + 5
Posted by: Guest on July-28-2021

Code answers related to "calculate sum in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language