WHY this work?:
while(true) {
var enemies = hero.findEnemies();
for (var i = 0; i < enemies.length; ++i) {
var enemy = enemies[i];
hero.attack(enemy);
}
}
BUT this not work?!:
while(true) {
var enemies = hero.findEnemies();
if (enemies) {
var i = 0;
var enemy = enemies[i];
hero.attack(enemy);
}
}