Can some body explain this to me please?

Tell us what’s happening:
it says something about Logical Order in If Else Statements and I can’t really understand what should I do in this case, so any explanations will be appreciated, Thank you.

  **Your code so far**

function orderMyLogic(val) {
if (val < 10) {
  return "Less than 10";
} else if (val < 5) {
  return "Less than 5";
} else {
  return "Greater than or equal to 10";


  **Your browser information:**

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

Challenge: Logical Order in If Else 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.

I just described the problem, thanks !

What do you think orderMyLogic(4) should return?

I think it should return less than 5

But does it? What do you get if you try it?

I had problem with it myself,its logical problem…
it need to go from smaller to bigger.
dont slap yourself in head xD


try this if im not wrong…95% i think its that.
your dear ,fellow n00b

1 Like

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

make sense… first reply so i just wanted to prove,not even thinking.
not gonna repeat my mistake. sorry.

1 Like

It just keeps saying

should return the string
Less than 5

I really can’t figure it out :rofl:

Well, the code is executed in order

Is this true with 4?

Now I figured it out, thank you so much for the hints, I really appreciate that :heart: :heart:

1 Like

Think of it like this.

You have someone skimming your directions and applying them. If someone is applying the first part of that direction and it works, they have no reason to continue with the rest of that direction.

In your code you have said that if the number is less than 10 print this. Therefore, any number less than 10 will be what?

1 Like

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