So the goal of this step is to get the average for a list of scores.
So the step gave you this equation
average = sum of all scores / total number of scores
so you need to figure out this part first
sum of all scores
How do you get the sum of all numbers in a array?
It looks like you were starting to do that here but have some syntax errors.
so whenever you are stuck, and not sure how to do something in programming, you can google it.
in this case, you can google “how to get sum of all numbers in array javascript”
when you do that, you will get dozens of results on how to do that like this result here
once you get that working, then you need to return this calculation here
average = sum of all scores / total number of scores
so you don’t want to return the length like you are trying to do here
instead you need to return this calculation because that calculates the average of the scores
Hi @awet !
Please use a while loop instead of a for loop to iterate through the scores. I was facing the same issue with the for loop, but after switching to a while loop, everything worked fine. I have attached a screenshot of my code for your reference.
It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.
We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.