Tell us what’s happening:
Hi! I’m having some trouble with the Logical Or instructions. They say:
Combine the two
if
statements into one statement which returns"Outside"
ifval
is not between10
and20
, inclusive. Otherwise, return"Inside"
.
I’m struggling to do that in a way that uses OR, as the program requires - it specifies OR (||) and not AND (&&) so I can’t do it in, you know, a normal way. I assume someone’s passed this at some point… any hints?
Your code so far
function testLogicalOr(val) {
// Only change code below this line
if (val > 10 || val < 20) {
return "Outside";
}
// Only change code above this line
return "Inside";
}
testLogicalOr(15);
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36
.
Challenge: Comparisons with the Logical Or Operator
Link to the challenge: