FinalGrade in JS

How do I console.log to see the results of the FinalGrade below:

const finalGrade = (g1, g2, g3) => {
    if ((g1 < 0 || g1 > 100) || (g2 < 0 || g2 > 100) || (g3 < 0 || g3 > 100)) {
        return 'You have entered an invalid grade.'
    }
  let average = (g1 + g2 + g3) / 3
  
    if (average < 60) {
        return 'F'
    }
    else if (average < 70) {
        return 'D'
    }
    else if (average < 80) {
        return 'C'
    }
    else if (average < 90) {
        return 'B'
    } else {
        return 'A'
    }
}

console.log(average 92, 78, 83)

ERROR: It’s missing after argument list. What am I missing on this one?

Hello, @css9839427193.

Welcome to the forum.

You need to call the function finalGrade() as the argument to your console.log() method.
You’ll need to supply the grades as the argument to the finalGrade() function.
Similar to this:

const sumNums = (num1, num2, num3) => {
  return num1 + num2 + num3;
}

console.log(sumNums(5, 10, 15)); // Output: 30

I was able to achieve what I’m trying to do with your help on the code especially the return statement. Big THANKS midlindner!!!

function finalGrade(g1, g2, g3) {
   
    return g1 + g2 + g3;
    
      if ((g1 < 0 || g1 > 100) || (g2 < 0 || g2 > 100) || (g3 < 0 || g3 > 100)) {
          return 'You have entered an invalid grade.'
      }
    
      if (average < 60) {
          return 'F'
      }
      else if (average < 70) {
          return 'D'
      }
      else if (average < 80) {
          return 'C'
      }
      else if (average < 90) {
          return 'B'
      } else {
          return 'A'
      }
  }
  console.log(finalGrade (80, 95, 90) /3);

Although it is not giving me the ‘String’ A or B or C …It appears to only calculate the console.log on the bottom but at least is showing some output and move on to the next…?

My example was only meant to show the syntax. Your return statement:

Is returning the numbers added together, and then you are dividing the sum by 3 after the sum is returned to here:

However, that is not giving you the letter grade. Go back to your original code, and just use the syntax from my example in the console.log() statement. That should produce the output you are looking for. Sorry for the confusion.

Basically: