Please help me.
I can’t understand the place of enemyIndex++;
while (true) {
var enemies = hero.findEnemies();
var enemyIndex = 0;
while (enemyIndex < enemies.length) {
var enemy = enemies[enemyIndex];
if (enemy.type != "sand-yak") {
// While the enemy's health is greater than 0, attack it!
while (enemy.health > 0) {
hero.attack(enemy);
}
enemyIndex++;
}
}
hero.moveXY(40, 32);
}