Shield Rush Problems in JavaScript

I am stuck on Shield Rush level! Argh. I have read through everyone’s comments and I still can’t find a solution. Any help would be appreciated!
Here is my code:
if (this.isReady(“cleave”)) {
this.cleave(enemy);
this.shield();

}else {
this.attack(enemy);
}

Welcome to the forums aubrey but PLEASE read the FAQ to format you code properly with triple backticks lick this is your code formatted properly

if (this.isReady("cleave")) {
this.cleave(enemy);
this.shield();

}else {
this.attack(enemy);
}

At first sight Im seeing the fact that you are not checking if an enemy is there before attacking use this

else if(enemy){
    this.attack(enemy);
}

(I am assuming that you declare var enemy)

and you are suppose to not use attack just shield and cleave so you code should be this

if (this.isReady("cleave")) {
this.cleave(enemy);


}else {
this.shield();
}

with an “if(enemy)” of course

if (enemy && this.isReady("cleave")) {

Thank you both! I figured it out-
loop {

var enemy = this.findNearestEnemy();
if (this.isReady("cleave")) {
 this.cleave(enemy);  

} else {
this.shield();
}