Tell us what’s happening:
How can I get this
orderMyLogic(6) should return “Less than 10”
Your code so far
function orderMyLogic(val) {
if (val < 5) {
return "Less than 5";
} else if (val < 10) {
return "Less than 10";
} 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 10.0; rv:59.0) Gecko/20100101 Firefox/59.0.
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";
}
}
question says: orderMyLogic(4) should return “Less than 5”
I’ve edited your post for readability. 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.
Pruebe con esto:
function orderMyLogic(val) {
if (val < 10 && val > 5) {
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);
function orderMyLogic(val) {
if (val < 6) {
return “Less than 5”;
} else if (val < 7) {
return “Less than 10”;
} else {
return “Greater than or equal to 10”;
}
}
I’ve also got its now i need to change the value that need to be checked which was 4 and work from top top to bottom vice versa.(I don’t know if i explain that correct but that is how i understand it)