I have this challenge that I cannot overcome. I am only missing one of the following three conditions: orderMyLogic(4) should return "Less than 5" orderMyLogic(6) should return "Less than 10" orderMyLogic(11) should return "Greater than or equal to 10" I have Tried countless changes and I'm always missing one of the conditions. With this code, I am getting past: orderMyLogic(6) should return "Less than 10" orderMyLogic(11) should return "Greater than or equal to 10" . But this fails me: orderMyLogic(4) should return "Less than 5" I show my code so you can see what I'm doing wrong. Thanks.
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);
I will tell you the following, as well as this, your code does not work because the number 4 also fits in the first condition, that is why it does not go to your second else if; To get the desired value you must do the following: