Having trouble on Agrippa Refactored (JavaScript)

please help this is my code
function cleaveOrAttack(enemy) {
// If “cleave” is ready, cleave; otherwise, attack.
if (hero.isReady(“cleave”)) {
hero.cleave(enemy);
} else {
hero.attack(enemy);
}
}
while (true) {
var enemy = hero.findNearestEnemy();
if (enemy) {
var distance = hero.distanceTo(enemy);
if (distance < 5) {
// Call the “cleaveOrAttack” function, defined above.
cleaveOrAttack(enemy);
}
}
}

can someone please tell me what i’m doing wrong

Please format your code according to the FAQ. Also send a screenshot with more info about your problem

2 Likes

Screenshot 2019-12-18 at 10.34.17 AM

My Guy Just Stands There After He Cleaves