you need to build the function, this function always return 71.7 indipendently by what series of scores it is given to it.
Try to work only inside the function, from what you wrote I can see you know how to calculate an average
your function getAverage will be given an array so I’m not sure what you mean by “set scores to the arrays”.
You should assume you are getting an array and go from there.
the array and inputs you will get will be passed as argument of the function . You don’t need to hardcode this . first understand the problem :
there is an array passing by user as an argument whose name is scores . only we have to perform our operations over scores array we don’t know what value is getting inside this array for testing.
2.You have to write your logic inside a function whose name is getAverage .you have access of scores array inside this since it is passing as parameter and4. you have to perform your operations inside this function.
Total no. of scores = total no. of input inside scores = scores.length ;
you have to return a variable name average whose value is :
sum of all inputs of array / total no. of scores .
Well, I’ve got steps 1 and 2 down, but steps three and four confuse me. It’s saying that the getAverage function is already used and i’m not sure here to go from here.
I would tend to agree, use the help button on the step you are on now.
Otherwise, you have to post your new code. This thread was about step 1, but it sounds like you are now on step 3 or 4.
Instruction for posting code:
When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.