Onboarding in javascript

what I am suppose to do with this code? I am very new this game. I always lose the game. whats going on? I dont understand at all.

EDIT: No full code please

and one more thing which one is the variable to use the cannon shoot the enemy.

Are you sure that it’s a good idea to shoot the farthest enemy?

Simply printing the name of the enemy will shoot at it.

But have a look at your code:

  1. You’re not shooting the closest enemy.
  2. You’re not printing the enemy’s name but the variable containing the name.

Good luck!

Thanks for helping. How would you do find all the enemy’s variable name? Does I have to press the play game all the time and I can see who the enemy killed me. and update the code?

p.s. Please ingorne this message what I did is go to setting and debug turn ON. THESE will tell you all the variable name.

You have to make your program so it works with ANY name. You can get the names of 2 closest enemies after each shot. I suggest reading the problem description very carefully, use a dictionary if you don’t understand something.

I’m closing the topic, use the onboarding topic to speak about that