Comparisons with the Logical Or Operator and the right test

Tell us what’s happening:

Thanks FCC. Explain to me what’s going on and what the syntax numbers should be. I did create an extra test condition, which does work for the ranges I’ve provided.

Thanks for the Flourless Chocolate Cake.
Your code so far

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

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

 else  {
    return "Inside";

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

// Change this value to test

Your browser information:

Your Browser User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36.

Link to the challenge:

The challenge states:

returns “Outside” if val is not between 10 and 20, inclusive

Or in other word if the number is less than 10 or more than 20.

On the other hand your code will return outside for every number that is less or equal to 20:

if (val <= 10 || val <= 20)

Which it should not :slight_smile:

1 Like