RSRobince Studio

JavaScript If...Else

An if statement runs code only when a condition is true. Add else for the other case, and else if for more branches.

if (score > 50) {
  console.log("Pass")
} else {
  console.log("Try again")
}
Try it yourself

Loading editor…