function orderMyLogic(val) {
if (val < 10) {
return “Less than 10”;
}
else if (val < 5) {
return “Less than 5”;
}
else {
return “Less than five”;
}
}
// Change this value to test
orderMyLogic(7);
This is what I am working on at the moment. Feel my brain is about to make a breakthrough!
Ok, I got it by looking at the solution. Sometimes the instructions on freecodecamp.org can be a little confusing. But what I learnt is:
If the “if” statement is true then the code stops there. There is no need to go any further.
If the “if” statement is not true it moves to the “else if” statement.
If this also is not true the code executes the “else” statement.