I dont what wrong with the code nut after clicking on run the test its not getting complied

Tell us what’s happening:

  **Your code so far**

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

if (val<=50 && val>=25) {

    return "Yes";
  }
}

// Only change code above this line
return "No";
}

testLogicalAnd(10);
  **Your browser information:**

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

Challenge: Comparisons with the Logical And Operator

Link to the challenge:

So the error says

SyntaxError: unknown: 'return' outside of function (10:0)

   8 |
   9 | // Only change code above this line
> 10 | return "No";

Why would it think that return "No"; is outside the function? If I format what you’ve written slightly:

function testLogicalAnd(val) {
  if (val<=50 && val>=25) {
    return "Yes";
  }
}

return "No";
}

Just remove the curly brace after return "Yes";

ya i got that .
thnx for your advice

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.