Review JavaScript Fundamentals by Building a Gradebook App - Step 1

Tell us what’s happening:

I don’t really understand what I am supposed to do here because there aren’t enough help in the step. Please explain every step so good you possibly can.

Your code so far


// User Editable Region

function getAverage(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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36

Challenge Information:

Review JavaScript Fundamentals by Building a Gradebook App - Step 1

hi there,

Each step is supposed to be self-explanatory.
We are here to help you with a specific question if you don’t understand something you read or something in the code.

For eg. in this step it says:

Complete the getAverage function which takes in an array of test scores and returns the average score.

If you have a question about how to calculate the average, you could start by sharing with us what you have understood from this and what you need help to understand still.

If it is an issue with another part of the step, please tell us which part and what you need help with.

1 Like

Alright. I don’t understand why you start by adding let sum = 0; because why is the sum if these numbers supposed to be 0?

I don’t see any code or instruction that says you need to write let sum= 0;

Can you share the code you are reading from?

How do I do that? The code is taken from step 2

function getAverage(scores) {
let sum = 0;

Hi,
The code in its original form in step 1 doesn’t have let sum = 0;
It’s up to you if you want to add that line of code to start with.
In the second step, This line exists but it doesn’t mean the sum of the numbers is 0. That’s just a variable that will later on be used to get the sum of two numbers, so originally it must be 0. btw, if you complete step 1 then you will know why that line is there in step two. Hope this helps!