Answers for "get average and sum javascript"

0

javascript find average of numbers

const average = (...args) => args.reduce((a, b) => a + b) / args.length;

average(1, 2, 3, 4);
// Result: 2.5
Posted by: Guest on September-28-2021
0

get average and sum javascript

var sum = array.reduce((a, b) => a + b, 0);	//get sum of all elements in array
var avg = (sum / array.length) || 0; //get average of all elements in array ;)
Posted by: Guest on October-10-2021

Code answers related to "get average and sum javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language