I am stuck on this challenge. I have check the hint for this challenge and tried the solution but it did not pass the test. The last thread about this challenge dates back to Dec 2019 (quiet old already). I think its time to get additional inputs about this challenge. Hope to see the communities inputs.
**Your code so far**
function testLogicalOr(val) {
// Only change code below this line
if (val > 0 || val < 19) {
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) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36
Challenge: Comparisons with the Logical Or Operator
The issue with your code lies not with the logical OR. Here is the requirement lifted from the challenge:
Combine the two if statements into one statement which returns the string Outside if val is not between 10 and 20 , inclusive. Otherwise, return the string Inside .
I have added the logical operator && in the code - it passed the test. Thank you for reading my post. Maybe there are other solutions to this challenge, hope others can share.
function testLogicalOr(val) {
// Only change code below this line
if (val < 10 || val > 20 && val > 14) {
return “Outside”;
}
// Only change code above this line
return “Inside”;
}