Gold Rush - Super Beginner - needs help

Hey there I’m super new to coding and was working as a human on a beginner level for the Gold Rush game. Can anyone please tell me what I am doing wrong and what needs to be fixed?

var me = this;
var items = this.getItems();
var enemy = this.getNearestEnemy();
function what(item) {
    if (item.bountyGold() == 5) {
        return "gem";
    } else if (item.bountyGold() == 4) {
        return "gold";
    } else if (item.bountyGold() == 3) {
        return "silver";
    } else if (item.bountyGold() == 2) {
        return "bronze";
    }
}
var i = 0;
if (what(items[i]) === "gem" || what(items[i]) === "gold") {
    me.move(items[i].pos);
} else {
    ++i;
    me.moveXY(18, 40);
}

thanks a whole bunch!!

I am not completely sure but you need to erase line one
if you could tell me what is going wrong I could help you more

there’s nothing wrong with line 1. he’s simply setting me to this and he uses it later on.

One thing i notice you use .move and .moveXY but those 2 functions aren’t on the same types of boots.

Oh and a tip if you use moveXY(which I recommend) you can set the x and y pos’s to variables then insert those into your moveXY

But this is for gold rush, not based on hero boots. Should be able to use both move and moveXY there.

As for what you did wrong. It looks like you forgot to put the last chunk inside of a loop. Basically you will attempt to go to the first item in your list if it is a gem or gold, otherwise, you will go to 18,40 and stand there because each time you are looking only at item 0.