Review JavaScript Fundamentals by Building a Gradebook App - Step 1

Tell us what’s happening:

i am truely lost, i dont what to do. I’m kinda lost

Your code so far


// User Editable Region

function getAverage(scores) {
let sum = 0;

}

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/129.0.0.0 Safari/537.36

Challenge Information:

Review JavaScript Fundamentals by Building a Gradebook App - Step 1

Can you tell us more about what is confusing you?

Your function needs to iterate over an array of numbers to find the average.

The average is calculated by adding up all the scores and dividing by the total number of scores.

Tips

  • You can use a loop to iterate over the scores array and add up all the scores.
  • You can use the length property to get the total number of scores.

Your sum variable could be used to keep a running total as you iterate the array with a for loop, for instance. Then, after your loop has finished, you can divide the total (sum) by the length of the array to find the average. That’s the value which you should return from your function.

i have no idea where to start from, i barely passed the previous stages.

still confused, maybe i should give it time before re-attempting.

We can help you more if you give us an idea about what is making you stuck. Is there a specific sentence you need help understanding or a concept? The more descriptive your question, the more targeted the help.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.