Basic JavaScript: Comparisons with the Logical And Operator

Tell us what’s happening:
Th=he code doesn’t work. Please help me.

SyntaxError: unknown: Unexpected token (4:11)
Your code so far

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

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

  return "Yes";
return "No";

// Change this value to test

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36.

Challenge: Comparisons with the Logical And Operator

Link to the challenge:

It actually underlines where your error is. “less than or equal to” (which it asks for) is not the same as “equal to or less than”

1 Like

Thank you. That works.

Hi, I am struggling with this lesson too. Below is my code. It won’t let me pass the test. Can someone help? Thank you.

function testLogicalAnd(val) {

if (val  <=  50  &&  val  >=  25) {
  return "yes";

return “No”;


Here is the test response:

// running tests```

testLogicalAnd(25)should return "Yes"
testLogicalAnd(30)should return "Yes"
testLogicalAnd(50)```should return “Yes”

// tests completed

1 Like

Your logic looks correct…maybe try to capitalize the y? (return “Yes” instead of return “yes”). The tests can be very nit-picky sometimes!


Thank you! That fixed it.

1 Like