Comparisons with the Logical Or Operator

This is there code

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”;
}

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

This my code below

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

if (val > 21 || val > 21) {
return “Outside”;
}

// Only change code above this line
return “Inside”;
}

// Change this value to test

testLogicalOr(21);
follow this link

1 Like

did you read the instructions?

Instructions
Combine the two if statements into one statement which returns “Outside” if val is not between 10 and 20, inclusive. Otherwise, return “Inside”.

your code is not fulfilling the requirements given in the instructions. Basically you should look at your numbers in the if statement. in English if val is less than 10 or greater than 21, number will be out of range. If I say anything else, it would be the solution. I can do that if you want. Keep at it mate.

yes. I don’t the test part

The solution is:

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

if (val < 10 || val > 20 ) {
return “Outside”;
}

// Only change code above this line
return “Inside”;
}

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

3 Likes