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

can anyone please tell me, why here OR(||) logical operation needed? I don’t understand the use of || here. please explain the reason. I m confused a lot!!!

Hi there,

The challenge asks you to rewrite the code such that if the val parameter is not between 10 and 20, then the function is to return “Outside”.

This code if (val < 10 || val > 20), tests the logic that if val is less than 10, or greater than 20, then return “Outside”. Another way to read it is: if val is not between 10 and 20, return “Outside”.

The important lesson to learn from this lesson is the difference between || and &&. In this case, it is impossible for val to be both < 10 and > 20.

Summary: The statement is representing: 10 <= val <= 20.

Hope this helped.

Your code has been blurred out to avoid spoiling a full working solution for other campers who may not yet want to see a complete solution. In the future, if you post a full passing solution to a challenge and have questions about it, please surround it with [spoiler] and [/spoiler] tags on the line above and below your solution code.

Thank you.