Problem on Lurkers Level, nothing happens - SOLVED

I am using Javascript. I succeed charging the level and nothing seems wrong, but when I run my code, nothing happens except the time bar continues. There isn’t even a error message. Here is my code:

// findEnemies returns a list of all your enemies.
// Only attack shamans. Don't attack yaks!

var enemies = this.findEnemies();
var enemyIndex = 0;

// Wrap this section in a while loop to iterate over all enemies.
while (enemyIndex<3) {
    var enemy = enemies[enemyIndex];
    if (enemy.type == 'shaman') {
        while ( > 0) {

Could you please find the error ?

You create the while-loop to iterate over 3 enemies. However, there are more than three enemies. The comment specifically says to iterate over all enemies.

What do I then write into the while condition and why do I need it ? I could as well do If (enemy).

Since it iterates over all enemies, wouldn’t it be best to make the while-loop iterate over all enemies in the list enemies? Therefore, use len to find the length of the enemy list, then iterate over that many. (Go back to Sarven Savior if you need a recap on len.)

You need to learn how to use these while-loops. They will be important in the future.

Thanks for your comment ChronistGilver. Your solution is right.