Ad
  • Custom User Avatar

    The thing is, simply replicating the formula in a function is super-easy, so would be kinda pointless, I think.

  • Default User Avatar

    Minimizing calls to Math.sqrt is a bit overzealous for this problem imo.

  • Custom User Avatar

    Is this question resolved?

  • Custom User Avatar

    The message should say something like "You passed the tests with x calls to Math.sqrt." So it's the total number of calls over all tests, not just from a single call.

    Other than that, there may be further ways of reducing the need to call Math.sqrt within your code. It's been a while since I wrote this kata, so I can't remember all the algebra associated with it, but that's probably the problem, anyway. Perhaps someone else can give you further help?

  • Custom User Avatar

    I've added some better messages for the tests now; is it clearer?

  • Custom User Avatar

    If the message says "x = undefined" it means you returned an array with no items, or undefined as the first item. If x cannot be found, undefined should be returned, not an array. I'll try to make this clearer in the test messages.

  • Default User Avatar

    can we check the radius is the number type using "typeof"?if the radius's type is "number",then we can use the if-else again?