Review JavaScript Fundamentals by Building a Gradebook App - Step 1

Tell us what’s happening:

Ive read some guides online and looked at forum. I dont know how to add a let before what I have how to name it to make a array and also in body what to do.

Your code so far


// User Editable Region

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

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/126.0.0.0 Safari/537.36 Edg/126.0.0.0

Challenge Information:

Review JavaScript Fundamentals by Building a Gradebook App - Step 1

There are a couple of problems with this loop setup:

  1. You shouldn’t be trying to measure the length of getAverage as that is the function name. You need to measure the length of the array which is passed as an argument to the function (i.e. scores).
  2. You have a syntax error. You have a comma after getAverage.length. You should separate your terms with semicolons instead.

As for the loop body, you’re iterating an array of numbers with the loop, so in mathematical terms, how do you find the average of a list of numbers?

I fixed the for loop having a problem with the rest i have been seeacring they all use var or have two lets before the for to make a variable should i have the lets first.

we can’t see your new code.

please share it.

function getAverage(scores) {

for(let i= 0; i < scores.length; i++) {

}

}

I finished the first I am having problems searching getting many different ways to do it getting overwlemed a little

okay this is just a matter of looking at it from a different lens.

if you had a piece of paper with 10 numbers on it, how would you find the average?
(no calculator)

add all the numbers then divided the amount of numbers for answer

so when you add the numbers, are you doing it in your head?
how are you keeping track of the sum?

no im not doing it my head. Im trying here this is a hard lesson.

so the sum is somewhere on the paper right?

translate that to the code.
You need to add the numbers and write the sum somewhere.

i think the next code using a += maybe with two variables but which ones?

think about it like that. When I said the paper had 10 numbers. What if I said, there were 10 pieces of paper and you had to add the values but I would only hand you one number at a time.
So you can only see one number at a time.
How would you add them up then?

i need a break ill reply and try tomorrow been coding the last 5 days straight and a little today my mind just cant figure it out tonight thank you for help ill try tomorrow