You see you have the scores variable. You need to find the sum of all the scores and divide them by the length of the scores to find the average. You can use a for loop and a sum variable to find the sum of the scores, for (const score of scores) like this. And for the length you can use scores.length simply.
First of all, you need to know how to calculate average.
The “scores” is an array. And it is possible to find how many elements are available in that array with the " length" property of the array. (ex: scores. length)
You can loop through each element of the array with “for” loop. (ex: for (i = 0; i < scores. length; i++))
After that it should be straight forward calculating the average.
When you’re iterating an array with a for loop, you generally need to start at 0 (as arrays use zero-based indexing). Also, if you’re iterating the whole array, you need to iterate up to (and including) the final index in the array. Because of zero-based indexing, this will be equivalent to the length of the array, minus one.
This code, for instance, will log all elements in the array to the console:
let array = [1, 2, 3, 4, 5]
for (let i=0; i<array.length; i++) {
console.log(array[i]);
}