How to use conditional statements in javascript?

Conditional statements in JavaScript include if, else if, and else.

Example:


  let age = 18;
  if(age < 18) {
      console.log("Underage");
  } else {
      console.log("Adult");
  }
  // Outputs: Adult
  

Beginner's Guide to JavaScript