Ad
  • Custom User Avatar

    nice refactoring

  • 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?

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • 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

    For the quadratic equation: 0x2 + 0x + 0, expected: cannot find x; got: x = undefined

    How is this different?

  • Default User Avatar

    toFixed() returns a 'string' and you need to return a number.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • 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?

  • Default User Avatar

    Second test case incorrect. Useless kata.

  • Default User Avatar

    Can anyone explain how type checking works here? Top solutions don't check for number's type. They just check for " > 0". Does it cover every possible case? So whatever input we give, if it's value is > 0, then it's a number?