Can someone help me in this?

Can someone help me in this?
0.0 0

#1

Tell us what’s happening:

How do I solve this problem?

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

// Change this value to test
orderMyLogic(5);

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Windows NT 6.3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36.

Link to the challenge:


#2

Well, if you want the message “less than 5” to be returned, you need ask it first. If you do not, then if the number 3 is sent to the function, so val = 3 inside the function, then the current version of the function will simply return “Less than 10”, which is not what we want to happen. Once a return statement is used, the function is exited and no other code is evaluated/executed within the function.


#3

Still can’t do it? Tried many times but i am getting stuck.


#4

Copy and paste the latest code you tried into your reply.


#5

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”;
}
}

// Change this value to test
orderMyLogic(4);


#6

its done now… Thanks
I solved it


#7

Excellent! I know you did not use the most recent code you posted.

By the way, when you enter a code block into the forum, precede it with a line of three backticks and follow it with a line of three backticks to make easier to read. See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.