Ad
  • Custom User Avatar

    From the official Documentation: retired.

  • Custom User Avatar

    It's retired, nothing left to do with it. Why open an issue on an already retired kata? Closing.

  • Custom User Avatar

    this Kata has been retired because there is an issue with leading zeros.
    Eg. maxNumber(0010) should output 1000 right??
    Well the browsers automatically treat such number as binary and convert it to: 8 (decimal number), so our code also will output 8.
    In order to resolve this, in case we have leading zeros we should use .toString(2) , but how to check if our input number has leading zeros??

  • Custom User Avatar

    apart from 'Best Practices' and 'Clever', there should also be 'Quantum' vote

  • Custom User Avatar

    yes, match returns an array, even if there is only one match, so we have to point to eg the first item [0]
    '----123--45--'.match(/(\d+)/)[0] //123

    otherwise we will get an array of two, with the same item:
    '----123--45--'.match(/(\d+)/) // [123, 123]

  • Custom User Avatar

    The problem is with passing an argument with leading zeros which browsers treat as octal number. Eg. 015 is beeing converted to 13 which throws our code off. If there was some way to test whether our input have leading zeros, then in such case we might convert it to decimal eg. 015.toString('8') gives 15, so 1+5 = 6.