Skip to content

Latest commit

 

History

History
24 lines (21 loc) · 343 Bytes

File metadata and controls

24 lines (21 loc) · 343 Bytes

A common use of if statements is inside of functions.

function getGrade(score) {
  if (score >= 80) {
    return "A";
  }
  if (score >= 60) {
    return "B";
  }
}

You can also write this using else if:

function getGrade(score) {
  if (score >= 80) {
    return "A";
  } else if (score >= 60) {
    return "B";
  }
}