Answers for "how to return average numbers javascript"

CSS
3

javascript average of numbers in array

const scores = [ 20, 50, 75, 100, 115 ];
let total = 0;

for ( let i = 0; i < scores.length; i++ ) {
  total += scores[i];
}

console.log( total / scores.length );
Posted by: Guest on September-05-2021
1

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 "how to return average numbers javascript"

Browse Popular Code Answers by Language