Review JavaScript Fundamentals by Building a Gradebook App - Step 2

Tell us what’s happening:

I’m stuck on this step .it’s challenging me, I don’t know what to correct. anyone around to help me ?

Your code so far

function getAverage(scores) {
  let sum = 0;

  for (const score of scores) {
    sum += score;

  return sum / scores.length;

// User Editable Region

function getGrade(score) {
  if(score == 100){
  else if (score >=90){
  else if(score >=80){
  else if(score >=70){
  else if(score >=60){
  else if(score <=59){


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

Challenge Information:

Review JavaScript Fundamentals by Building a Gradebook App - Step 2

you need to return a value from the function, not print it

1 Like

here is my question: when to console.log or use return?

you return where you have the value you want to return, in this case it would be the letter grade corresponding to the score

in this case the instructions say

Your function should return a string representing a letter grade based on the score.

It says you need to return a string, so if you use console.log instead you are not returning it and the function is not complete