Chained If Help

Tell us what’s happening:
Describe your issue in detail here.

  **Your code so far**

function testElseIf(val) {

if (var > 15) {
  return "Bigger than 15";
} else if (var < 5) {
  return "Smaller than 5";
} else {
  return "Between 5 and 10";
}

}


testElseIf(15);

  **Your browser information:**

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.128 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 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.

Hi @papakodi !

Welcome to the forum!

I haven’t tested your code but it looks like this is the problem.

but it should be val.

Hi @papakodi,

Just convert the existing if clause within the function using if/else statements.

Use ‘val’ instead of ‘var’ and the conditions are if (val > 10), else if (val < 5), else {…}

Cheers!

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