guys I dont get the purpose of this challenge , where it say change order so that it will return the correct statements in all cases. what does it mean?
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";
}
}
orderMyLogic(7);
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_1) AppleWebKit/604.3.5 (KHTML, like Gecko) Version/11.0.1 Safari/604.3.5.
yes, passed it I saw the solution. but I don’t get the meaning this sentence:
change the order of logic in the function Sto that I will return THE CORRECT STATEMENTS IN ALL CASES.
From the explanation of the challenge, it is expected that if you pass a value less than 5 it should return the text “Less than 5” and if you pass a value greater or equal to 5 but less than 10, you should see the text “Less than 10” otherwise “Greater than or equal to 10”. Look at what is in the console and compare with the output of the correct solution you are submitting.
Hi, @SARA1985.
Another important note on this is to understand that after a return statement the code stops and gives no other output, so the logic is to return outputs for conditions in ascending order based on instruction or need.