Logical Order problem in If Else Statements

I’m a new learner. Please someone solve this and help me

The code is:

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";

orderMyLogic(4) should return "Less than 5"
orderMyLogic(6) should return "Less than 10"
orderMyLogic(11) should return "Greater than or equal to 10"

**Link to the challenge:**

I will not solve this for you but I will try to help you out by guiding you.

The key thing to remember about conditionals is that an an else/else if block executes ONLY if the test condition for the previous if or else if failed/returned false. This is very important to remember because in cases like the challenge above, test conditions for different if statements can overlap.
In such cases, you need to order your test cases from most specific/restrictive to most general. In this way, you will get the most information from the return value of a function (i.e. if you pass to a function 500 and the function gives you an answer, the number is bigger than 0, this is not very informative, however if the function gives you an answer, the number is bigger than 499, then it is much more informative).

I hope this helps.

let’s say that your value is 4, your first if statement is true, so than it returns "Less than 10"

There is something wrong there…

Remember that if the condition is true, the code is exeguited, if it false it goes to the next one

Try figuring out how to put it right

Thanks everyone. It was a simple problem. Though i’m a new comer thats why it seemed hard to me. Anyway, i’ve solved the prolem :smile: