Basic JavaScript - Comparisons with the Logical Or Operator

Tell us what’s happening:
Describe your issue in detail here.

Hello,
I think this statment is wrong " The logical or operator (||) returns true if either of the operands is true Otherwise, it returns false"
if we have "ture or false " does it return false ???
I know in jave returns true , isnt ?
thank you

Your code so far

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

  if (val) {
    return "Outside";
  }

  if (val) {
    return "Outside";
  }

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

testLogicalOr(15);

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:105.0) Gecko/20100101 Firefox/105.0

Challenge: Basic JavaScript - Comparisons with the Logical Or Operator

Link to the challenge:

just return the actual value from the statement and see:

function testLogicalOr(val) {

    return (val<10 || val>20)
 
}

console.log('higher:',
testLogicalOr(22)
)
console.log('lower:',
testLogicalOr(2)
)
console.log('between:',
testLogicalOr(12)
)
1 Like

This operand works exactly the same way in JS as in Java as in C as in every other language I have ever heard of.

That is, if either operand is true, which can be rephrased as if only one operand is true then it returns true.
(If both false then false)

1 Like