Link Search Menu Expand Document

Introducing Else Statements

Summary

  • The else statement is used when an if statement is not true.

Final Code

function testElse(val) {
  var result = "";
  // Only change code below this line

  if (val > 5) {
    result = "Bigger than 5";
  } else {
    result = "5 or Smaller";
  }

  // Only change code above this line
  return result;
}

testElse(4);