Need help with Kelvintaph crusader

The hint starts with: “// You can find friends through walls, but not enemies.

hero.findByType("ogre") # will not work

Only your friends can find enemies. See Array.filter() and Array.find() in array section.

function isOgre(enemy) {
  return enemy.type == 'ogre';
}
function isWitch(enemy) {
  return enemy.type == 'witch';
}
var friend = hero.findFriends()[0];
var enemies = friend.findEnemies();
var ogres = enemies.filter(isOgre);
var ogre = friend.findNearest(ogres);
var witch = enemies.find(isWitch);  
console.log(friend.id);
console.log(ogre.id);
console.log(witch.id);

The output in the console will be:

Gorgin 
Oni
Yzzrith

If you want to command your friends individually see the post How do I name my units?

This also will not work:

hero.command(friend, "move", { x: 50, y: 57 });
hero.command(friend, "move", {x: 50, y: 39});
hero.command(friend, "move", {x: 78, y: 40});

see: