Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

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";
  }
}