noximus
3/25/2019 - 5:16 PM

average of

function getAverageTestScore(scores) {

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

  }
  const avg = total / scores.length;
  // const avg = scores.reduce((a, b) => a+b )/ scores.length;
  return avg
}


let avg = getAverageTestScore([80, 100]);
console.log(avg, '<-- should be 90');