Review JavaScript Fundamentals by Building a Gradebook App - Step 2

Tell us what’s happening:

Hi all! I’ve attempted multiple ways to get this code working…and for some reason the test for 100% does not work, Ive also attempted to put as my first if statement parameter

if(score === 100) {
console.log("A++)
}

and I still get the error, this is how I have it now

function getGrade(score) {

if(score >= 0 && score <= 59) {
console.log(“F”)
} else if(score >= 60 && score <= 69) {
console.log(“D”)
} else if(score >= 70 && score <= 79) {
console.log(“C”)
} else if(sc

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 >=  && score <= ) {
    console.log("F")
  } else if(score >= 60 && score <= 69) {
    console.log("D")
  } else if(score >= 70 && score <= 79) {
    console.log("C")
  } else if(score >= 80 && score <= 89) {
    console.log("B")
  } else if(score >= 90 && score <= 99) {
    console.log("A")
  } else {
    console.log("A++")
  }
}

console.log(getGrade(96));
console.log(getGrade(82));
console.log(getGrade(56));

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

Challenge Information:

Review JavaScript Fundamentals by Building a Gradebook App - Step 2

This is invalid syntax

This is another example that I’ve done

function getGrade(score) {

  if(score === 100){
    console.log("A++")
  } else if(score <= 99 && score >= 90) {
    console.log("A")
  } else if(score <= 89 && score >= 80) {
    console.log("B")
  } else if(score <= 79 && score >= 70) {
    console.log("C")
  } else if(score <= 69 && score >= 60 ) {
    console.log("D") 
  } else {
    console.log("F")
  }
  
}
console.log(getGrade(96));
console.log(getGrade(82));
console.log(getGrade(56));

Console logging returns nothing from your function

So im missing a return statement after my if else statements?

Why would the return go after the if-else?

I attempted this way as well

function getGrade(score) {

  if(score === 100){
    console.log("A++")
  } else if(score >= 90) {
    console.log("A")
  } else if(score >= 80) {
    console.log("B")
  } else if(score >= 70) {
    console.log("C")
  } else if(score >= 60) {
    console.log("D") 
  } else {
    console.log("F")
  }

}
console.log(getGrade(96));
console.log(getGrade(82));
console.log(getGrade(56));

You’re still returning nothing there

Omg…i totally got it now, thank you so much. I guess I just tried following the examples too exactly

I would return from my conditions
Happy Coding Joseedominguez