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

Whats does this function return? [javascript]


Hello, this is a preloaded function in the level clumsy circle:

function onCircle(unit, radius) {
    var distance = hero.distanceTo(unit);
    // We check the approximation.
    var inaccuracy = 2;
    var minDistance = radius - inaccuracy;
    var maxDistance = radius + inaccuracy;
    return distance <= maxDistance && distance >= minDistance;

what I’m not sure, is, I need to find the units that are NOT on the circle, and this function tells you which ones are on it. I’m just not sure how I an put this inside "IF"
I’m not sur I really understand what the functions returns when the soldier is on the line or when he’s not…:confused:


it returns a Boolean either true or false


if that’s true, it returns true. else false