Basic Javascript - else if statement

function testElseIf(val) {
  if (val > 10) {
    return "Greater than 10";
  }else if (val < 5) {
    return "Smaller than 5";
  } else {
  return "Between 5 and 10";
}
testElseIf(7);

It’s not working

1 Like

add anather bracket in the end }

2 Likes

function testElseIf(val) {
if (val > 10) {
return “Greater than 10”;
}else if (val < 5) {
return “Smaller than 5”;
} else {
return “Between 5 and 10”;
}
} //->bracket
testElseIf(7);

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.