Tell us what’s happening:
So I thought i had this figured out, but then my code was only returning the first test score from each list. After messing around with it I seem to have just confused myself more. Now I am getting NaNs.
Its not the missing semicolons from this screenshot
Your code so far
// User Editable Region
function getAverage(scores) {
let total = 0;
for (let i = 0; i <= scores.length; i++) {
total = total + scores[i];
}
let average = total / scores.length
return average
}
console.log(getAverage([92, 88, 12, 77, 57, 100, 67, 38, 97, 89]));
console.log(getAverage([45, 87, 98, 100, 86, 94, 67, 88, 94, 95]));
// User Editable Region
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0
Challenge Information:
Review JavaScript Fundamentals by Building a Gradebook App - Step 1