Review JavaScript Fundamentals by Building a Gradebook App - Step 1

Tell us what’s happening:

I have no any idea to do this test… it’s so hard to me

Your code so far


// User Editable Region

function getAverage(scores) {
  for (let i = scores.length; i < 9; scores++) {
    
  }
}

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

Challenge Information:

Review JavaScript Fundamentals by Building a Gradebook App - Step 1

Hello.
This step requires you to find the sum of an array of numbers, and then find the average. There are several ways you can do this, one of the ways is by using a for loop as you did. However, Your for loop is missing some important parts. Normally, a for loop is created like this.

for(Initialization; condition; increment) {
//The code to execute after each loop.
}

The initialization specifies where your loop should start
The condition specifies how long a loop should run compared to its length when it is less than the condition.
The increment increases the initialization by one after every loop.

To get started with this challenge first of all structure your for loop in the correct way. Once you’re complete, we will move to the next step.

1 Like

thanks man i solved it just now

1 Like