Basic JavaScript - Comparisons with the Logical And Operator

Yes I didn’t write all of that though I just filled in certain areas like every other excersize.

I really, really, really am much, much, much more able to help if you post ALL of the code. All of it. Every piece.

It gets pretty confusing when you only post part of the code.

I DID I POSTED ALL OF THE CODE SEVERAL TIMES BRO AND ALSO HERE IS THE PART WHERE YOU TOLD ME TO DELETE IT

Ok, if this is all of your code, then please un-delete this part:

I didn’t tell you to delete these two lines.


When you say that the code above is all of your code, I would interpret that to mean that your editor looks like:
image

That can’t work because you need the first line that was there originally, declaring the function testLogicalAnd(val) is

Trust me I didn’t … And yes that is exactly what it looks like I never deleted anything because there was nothing like that to delete

I’ll give that a go give me a sec

These lines must be there. Since you seem to be saying that you don’t have these lines of code; you need to put it back. It should be lines 1 and 2 of your code.

That’s so weird mine never had that to begin with

Huh, there must have been a glitch where the forum injected code into your post. I though you had this originally because it was in your first post.

Go back to your initial code in the first post. Now re-write the conditional code just like the requirements says to.

if val is less than or equal to 50 and greater than or equal to 25

Replace “less than or equal” with <= and “greater than or equal” with >=

Edit: make sure your brackets {} match for each opening { there must be a closing } and in the end they should balance out (same amount of each).

Oh okay I must have not included that part yesterday sorry. This is the entire code I have at the moment just to clear things up.

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

if (val <= 50 && val >= 25) {
if (val) {
return “Yes”;
}
}

// Only change code above this line
return “No”;
}

testLogicalAnd(10);

This is what I have been doing so far but not working. Keeps saying I only need one "if " statement.

omg… I DID IT ALL I HAD TO DO WAS DELETE THE CURLY BRACKETS ARE YOU KIDDING ME

This line shouldn’t be there?

Just the curly brackets, figured it out

If you only deleted {} and nothing else from the last full code you posted, then there is a bug in the test suite and you passed with the wrong solution. The keyword ‘if’ should only appear once in your solution.

This is what I put in to get a pass:

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);

no bugs :slight_smile:

You deleted more than just the {} though?

You can use {} here

(Note, need both a { and a })

You just cannot include multiple if statements. You deleted the second if, which is why the code passed.

Hello. Check keenly your assignment conditions and relate to the question.
Here’s what you ought to have done:

Mod Edit: SOLUTION REMOVED

Happy Coding!