[SOLVED] Help - The Hunt Begins

PLease help me! I’ve been stuck here for quite a while. Thanks a lot!

// Senick is trying to find the elusive Burleous Majoris!
// "But he doesn't know how big a Burleous Majoris would be..."
// Find the average size of this burl population to use as a baseline!

// This function returns average size of all the burls in an array.
function averageSize(burls) {
    var sum = sumSize(burls);
    // Remember the average is the sum of the parts divided by the amount!
    return sum / burls.length;
}

// This function should return the sum of all the burls sizes.
function sumSize(burls) {
    // Implement the sum function using the burls 'size':
    var cumulator = 0;
    for (var i = 0; i < burls.length; i++) {
        var burl = burls[i];
        if (burl) {
            var burlHealth = burl.health;
            cumulator = cumulator + burlHealth;
        }
    }
    return cumulator;
}

while(true) {
    // Find the average size of the burls by calling the 'averageSize' function.
    var animals = hero.findByType("burl");
    var average = averageSize(animals);
    // Say the average size of the seen burls!
    hero.say(averageSize(animals));
}

Instead of this, put the variabile average.

Instead of

put this

burl.size

And in rest it looks fine to me.

Thanks i’ll try it now

Tell me if it works now, please.

Thank you so much :slight_smile: I’ve been struggling with this for a while. It worked.

Then, select the solution and write [SOLVED] in the title before the word Help.

Okay. I’ve done that.

Now, select the message that helped the most and click on the Solution for that message. And after that you’re done with this topic.

Okay. I’ve done that as well.

Congratulations! This is how you let everyone know that you do not have any more problems and congratations for completing the level!

1 Like

Thanks again for your help!

No problem! Glad I could help you! :smile:

By the way in the hints for this level, it says that we are supposed to add the health of the burl instead of its size. I wasn’t aware of a “size” attribute because it wasn’t in the available methods either. I don’t know if there’ any way to get editors to hear about this, but the guidelines were very misleading to me and it would be nice if it was corrected. Thank you for your understanding :slight_smile:

Oh great you solved it I cam in here for no reason