Borrowed Sword - Javascript - Improve my code

Hello,
My code works but I think it can be improved. Could you share your suggestions, improvements with me?

I think this code can be written shorter but I couldn’t figure out how

while (true) {
    var enemies = hero.findEnemies();
    var smallest = enemies[0];
    var friends = hero.findFriends();
    for (var i = 0; i < enemies.length; i++) {
        for (let j = 0; j < friends.length; j++) {
            let friend = friends[j];
            let enemy = enemies[i];
            if (enemies[i].health < smallest.health && enemies.health > 300) {
                smallest = enemies[i];
                hero.command(friend, "attack", smallest);
                hero.say(smallest);
            } else {
                hero.command(friend, "attack", smallest);
            }
        }
    }
}

thx for the code blud