Using else if statements

Tell us what’s happening:
Describe your issue in detail here.
Pls I need help with this, code is not running

  **Your code so far**
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(2);
  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/102.0.0.0 Safari/537.36

Challenge: Introducing Else If Statements

Link to the challenge:

formatting your code gives me:

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(2);

Can you see where you are missing a }

Hi @ ochejemoses, and welcome to the forum!

You have a missing right curly bracket ( } ) at the end of your function code.

It was probably deleted accidentally - if you add it back in then I think your code should pass the test.

okay thank you @JeremyLT

okay thank you @KittyMac

Done! thank you for the help

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