More solutions to using the "Or" operator

More solutions to using the "Or" operator
0

#1

Continuing the discussion from freeCodeCamp Challenge Guide: Comparisons with the Logical Or Operator:

This is for lesson number 177…

My gut says that this should work, but I don’t know why it does not.

I’ve extensively done problem exercises so I think I understand the concepts - and this answer has not been covered yet…quite surprising because I don’t think Im the next mark zuckerberg or anything :slight_smile:

So here is the work that I have done (I keep referring to “this” , which is below):

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


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

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

// Change this value to test
testLogicalOr(15);

Maybe this will help the database too?


#2

There are a couple of errors here.

  • The first { has no closing pair (there should be two } after the return 'Inside' line).
  • The testLogicalOr !== is not meaningful to the comparison.
  • The > and the < are swapped. Any numeric value will satisfy val > 10 || val < 20