Review JavaScript Fundamentals by Building a Gradebook App - Step 1

Tell us what’s happening:

I have tried everything and it still says my getAverage function should return a number. If someone could explain I would appreciate it.

Your code so far


// User Editable Region

function getAverage(scores) {
let total = 0;
for (let i = 0; i < score.length; i++){
  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

Challenge Information:

Review JavaScript Fundamentals by Building a Gradebook App - Step 1

HI @steelcreeperore !

Welcome to the forum!

When something goes wrong with your code, you should always check the console.

When I paste your code, I see this in the console

Hope that helps

1 Like

thank you so much, it’s always those small errors that get me.