Computer science 2, level 26

// Peons are trying to steal your coins!
// Write a function to squash them before they can take your coins.

function pickUpCoin() {
    var coin = hero.findNearestItem();
    if(coin) {
        hero.moveXY(coin.pos.x, coin.pos.y);
    }
}

// Write the attackEnemy function below.
// Find the nearest enemy and attack them if they exist!


while(true) {
    //attackEnemy(); // ∆ Uncomment this line after you write an attackEnemy function.
    pickUpCoin();
}

sry bro im not a sub

You need to write the attackEnemy function. Use the pickUpCoin function as a template.