ok so @Letti42 told me how already but im kinda dumb of how it works, please someone tell me how to implement it so the sprite can move to that said enemy.
(never thought the pythagorean therom was useful)
hypoDefender=Math.sqrt(Math.pow((defenders[e].x - enemies[i].x),2) + Math.pow((defenders[e].y - enemies[i].y),2));
if(hypoDefender < leastDist)leastDist = hypoDefender, closestEnemy = enemies[i];