Play Home Contribute Github Join Us! Discourse Staff Members Github Contribution Guides Team

Usual Day issue


The program will run properly with JavaScript, but I cannot get the last goal of under 8 statements. I tried combining both IF statements, but they will not function properly. I am including the complete code in the hopes someone more skilled could point out what I have missed. Thank you in advance!

while (true) {
var enemy = hero.findNearestEnemy();
var item = hero.findNearestItem();
if (enemy && enemy.type == “munchkin”) {
if (item && item.type == “coin”) {
var pos = item.pos;
var x = pos.x;
var y = pos.y;
hero.moveXY(x, y);


Nevermind, I figured it. Took a while, but I realized I.m not seeing all the coding, so when I call a method, its already declared the variables in it. I’m just using it.


just saying, but you should read the FAQ before you post anything. (Your code’s formatting is… cringe)