Comparisons with the Logical Or oper

Tell us what’s happening:

need someone to help…can’t get past this challenge…

Your code so far

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


  if(10 < val || 20 > val){
    return "inside";

  // Only change code above this line

// Change this value to test

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36.

Link to the challenge:

Hello! Updating your return values of “outside” and “inside” to what the challenge is asking results in passing all but 4 tests.

Also one of your operators is backwards. The way you have it written is difficult to read (maybe that’s just me) but I’d rewrite them as val > 10 || val < 20 and have another look at the logic you’ve done there.

Hi, welcome to the community!

There are a couple of problems in play here.

  1. Check your capitalization. What the challenge is asking for and what you are returning are a slightly different.

  2. Right now, you are checking: if (10 is less than val OR 20 is greater than val)
    So if we use the number 3 as val, we will get: if (10 is less than 3 OR 20 is greater than 3). Since 20 IS greater than 3, your function will return “inside”.
    If you look at the examples in the challenge, you will see them checking if the number is outside of their range, then return “Inside” if it is not. You are checking if the number is inside your range, and returning “outside” if not.

If this wasn’t clear enough, please let me know. It is pretty early and I haven’t finished my coffee yet, so I don’t know if this makes sense :slight_smile: .

Thanks i have managed the task.

thanks i have managed the task.