Answers for "js how to work out average of an array"

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
2

getting average of array javascript

var total = 0;
for(var i = 0; i < grades.length; i++) {
    total += grades[i];
}
var avg = total / grades.length;
Posted by: Guest on February-08-2021

Code answers related to "js how to work out average of an array"

Browse Popular Code Answers by Language