Hello! Please help me pass the level in the game CodeCombat

I just can’t understand how to solve this problem. Here is my code:

// Cообщи волшебнику расстояние до приближающихся огров.

// Эта функция находит ближайшего врага и возвращает расстояние до него.
function nearestEnemyDistance() {
    var enemy = hero.findNearestEnemy();
    // Если нет врагов, то функция возвращает 0.
    var result = 0;
    if (enemy) {
        result = hero.distanceTo(enemy);
    }
    return result;
}

while (true) {
    // Вызови функцию `nearestEnemyDistance` и сохрани результат в переменную `distance`.
    // сохрани результат в переменную `enemyDistance`.
    var enemyDistance = nearestEnemyDistance();
    // Если `enemyDistance` больше 0:
    var enemy = nearestEnemyDistance();
    if (enemyDistance) {
        // Скажи значение переменной `enemyDistance`.
        result = hero.distanceTo(enemy) = > 0;
    }
    
}

what should it do, what is it doing, what have you tried, tell us something about this

we can’t help you at all if you don’t give infos on that

I don’t say you need to do everything they ask in stackoverflow, but at this point it is seriosuly impossible to help you (the stakoverflow “how-to-ask” is here: https://stackoverflow.com/help/how-to-ask)