Logical Path Javascript

Code:

hero.moveXY(14, 24);
var secretA = hero.findNearestFriend().getSecretA();
var secretB = hero.findNearestFriend().getSecretB();
var secretC = secretA && secretB;
if (secretC)
    hero.moveXY(20, 33);
else
    hero.moveXY(20, 15);
hero.moveXY(26, 24);


if (secretA === true || secretB === true) {
hero.moveXY(38, 24);
}
if (secretB !==true) {
hero.moveXY(50, 24);
}

Do you have an error?

Why did you do this? I feel like the !== is wrong. This: != means it does not equal something. (For instance (python), if enemy.type != "munchkin": This: == means it does equal something. (For instance, if enemy.type == "witch":) By doing !== you’re making it unequal and equal to something.

…Maybe it’s =! or !=. Now I can’t remember if it’s the exclamation point first or not.

1 Like

The exclamation mark is first !=

2 Likes

It still says run out of time. It also provides an error that says use !== To compare with true. I will send you a screenshot later I’m on phone.

I’m not very familiar with Javascript, but shouldn’t the move statements be in {} ?

Your right, I got father to the treasure but not yet.

And thats strange, I didnt put that there…

If you can show your newest code, that’ll be good

c-can someone help me?? ;(

Can you paste your code?

1 Like

So that I can test it

1 Like

Oof I’m on a phone rn but my code is at the top of the topic

Woopsy, didn’t notice, thanks.

1 Like

I think 1 ur moveXy is wrong and 2 maybe u have an error?

Oh i managed to beat it but thanks

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