I’m trying to beat Sarven Shepherd and I’m using JavaScript. Here is my code: loop {
var enemies = this.findEnemies();
var enemyIndex = 0;
// Wrap this logic in a while loop to attack all enemies.
// Find the array's length with: enemies.length
while (enemyIndex < enemies.length) {
var enemy = enemies[enemyIndex];
// "!=" means "not equal to."
if (enemy.type != "sand-yak") {
while (health > 0) {
this.attack(enemy);
}
enemyIndex += 1;
}
}
// Between waves, move back to the center.
this.moveXY(40,32);
}