Logical OR Confusion

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" if val is not between 10 and 20 , 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";


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:

if(val > 10 || val < 20) means that val is inside if u want it outside you need to inverse your condition => if(val < 10 || val > 20)

1 Like

There’s just a logical error. val should be less than 10.