Learn Basic JavaScript by Building a Role Playing Game - Step 155

Tell us what’s happening: Hi ! I need some help about that code.It seems that I have a syntax error. Here is the message I have : You should use the logical AND operator && .

PS : I already look for the step 155 but they don’t correspond to the task. Here is my code

Your code so far

if(isMonsterHit && inventory.length !==1) {

}

WARNING

The challenge seed code and/or your solution exceeded the maximum length we can port over from the challenge.

You will need to take an additional step here so the code you wrote presents in an easy to read format.

Please copy/paste all the editor code showing in the challenge from where you just linked.

Replace these two sentences with your copied code.
Please leave the ``` line above and the ``` line below,
because they allow your code to properly format in the post.

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3 Safari/605.1.15

Challenge Information:

Learn Basic JavaScript by Building a Role Playing Game - Step 155

You changing the wrong if statement

Here is the correct if statement you need look at

if (Math.random() <= .1) {
    text.innerText += " Your " + inventory.pop() + " breaks.";
    currentWeapon--;
  }

add your check for the length of the inventory to that if statement to pass the tests

Hi thank you but I still have the same comments :
You should use the logical AND operator && and in the console : You should use the logical AND operator &&
. You should use the logical AND operator to check if inventory.length does not equal 1.

Here is my code :

 if(isMonsterHit && inventory.length !== 1) {

     }

Thanks in advance for your help))

It looks like you are still editing the wrong if statement.

You are still writing isMonsterHit here

but if you look at the if statement I sent earlier the first condition should be this

it looks like you are trying to change to many things and that is why the test is failing.

I would reset the lesson and make sure to start with this if statement here

make sure to add your second condition to check the inventory length after that first condition.
do not change that first condition

hope that helps

It helped greatly thanks again !!!