Else If Statements issue

Tell us what’s happening:
Describe your issue in detail here.
Am I missing something?

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

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

Challenge: Introducing Else If Statements

Link to the challenge:

Hello there.

Do you have a question?

If so, please edit your post to include it in the Tell us what’s happening section.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more information you give us, the more likely we are to be able to help.


You don’t have enough }. Count the {} pairs in your code! (Using indentation for the function body helps make this clear:

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

You are just missing the closing } for the function body

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

} // close the function body

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