I need to solve The Hunt Begins - Javascript Help!


#1
function averageSize(burls) {
var sum = sumSize(burls);
return sum / burls.length;
}

function sumSize(burls) {
var sum = 0;
var enemies = hero.findByType("burl");
for (var i = 0; i < enemies.length; i++) {
var enemy = enemies[i];
sum = sum + enemy.size;
}
return sum;
}

while(true) {
var burls = hero.findEnemies();
averageSize(burls);
hero.say("The average size of the seen burls " + averageSize(burls));
}

Why doesn’t my code work?


#2

Just say a number without the text.


#3

ty…


#4

You need a var to receive the sumsize