Basic JavaScript: Comparison with the Logical Or Operator

I need help with this challenge: https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/comparisons-with-the-logical-or-operator . I’ve tried this:

function testLogicalOr(val) {
  // Only change code below this line

  if (!(val >= 10) || !(val <= 20)) {
    "Outside";
  }

  // Only change code above this line
  return "Inside";
}

testLogicalOr(15);

this:

function testLogicalOr(val) {
  // Only change code below this line

  if (!(val >= 10) || val <= 20)) {
    "Outside";
  }

  // Only change code above this line
  return "Inside";
}

testLogicalOr(15);

and this:

function testLogicalOr(val) {
  // Only change code below this line

  if (val >= 10 || val <= 20) {
    "Outside";
  }

  // Only change code above this line
  return "Inside";
}

testLogicalOr(15);

What do I have wrong?

Why are you using <= and >=? Have you tried using < and >?

Yeah, I was doing it wrong. I got it just now. val < 10 || val > 20. I guess I misunderstood at first.

1 Like