This is hard and confusiing why nt work

Tell us what’s happening:

Your code so far

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

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

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


Your browser information:

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

Challenge: Comparisons with the Logical Or Operator

Link to the challenge:

  1. val should be inserted before the operator on both sides of ||
  2. if val is NOT between 10 and 20, so it should be LESS THAN ‘10’ or GREATER THAN 20.
1 Like

Well, your first point is more a convention than a requirement. Checking equality or comparison, the order is not as significant. Assignment, you’re absolutely right.

Your second point, though, is right. The expression as is asks “is val GREATER than 10 or greater than 20?”

Perhaps not, but the order will affect the condition that is being set.

val = 100;
if(val > 20) will always be true, but if(20 > val) will always be false, right?

1 Like

So then this should work?

  if (val < 10 || 20 > val  ) {
    return "Outside";
but it does not? why

no, this is true for val being 19, 18, 17… and below

you need a statement that is true for val being 21, 22, 23… and above

1 Like

you need this

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

your code is

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


1 Like

While your answer may be a quick solution, please explain it so that @Senkora can understand what your code does. We try to avoid giving direct answers, as learners do not learn how or why the code works, which results in zero understanding. Try to support learners by providing information that will help them arrive at the answer themselves.


I’ve edited your post for readability, and added spoiler tags around it. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

Thank you for understanding.

okay, i will do this in right way in future.

you are right. i will do this in right way in future.