Ad
  • Default User Avatar

    very clean and clear

  • Default User Avatar

    You should post this in the discuss thread of the kata you are having trouble with. You will see discuss with some speech bubbles just below the katas title. I believe this is the kata you are talking about. function within a function
    There are lots of things you can do with functions in javascript. In Javascript functions are actually just a special type of object so they can be returned or even passed around.
    so a function that returns another function would look something like this

    function a(n){
      return function(){
        ///do something with the argument n
      }
    }
    
    var b = a(9)
    // then b is a function that does something with 9
    b()  // is the same as a(9)()
    

    I hope that helps. If you are still stuck or just want to learn more about functions in functions here are some things to research on Google

    • Javascript closures
    • Immediately Invoked Function Expressions(IIFE)
    • Javascript scope
  • Default User Avatar

    you are missing a space somehow
    There should be 2 spaces before the ^ on the second line

  • Default User Avatar

    Enjoyable kata. It would be nice to see more of these harder math katas approved, but unfortunately they dont get many people solving them

  • Default User Avatar

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

  • Default User Avatar

    Very good kata!

    There is a minor error in your default test cases.

    The last test is

    Test.assert_equals(rsa.encrypt(2790), 65)
    

    But it should be

    Test.assert_equals(rsa.decrypt(2790), 65)
    
  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar
  • Default User Avatar

    in the default test cases you expect "f(x) = 1x" as the answer, but in the submission tests '1x' is always converted to 'x' unless its '- 1x'. To fix simply change the first default test case to expect "f(x) = x" so that the same solution can pass the submission tests and the default tests.

    This is an excellent kata. Thanks for making it

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

    There are no default test cases. Thats the error you get when no tests are run. It will work when you submit. Or you can write your own tests

  • Default User Avatar

    Wow you really went all out developing a bigint library to solve it. Impressive!
    It looks like it will work all the way up to getPolydivisible(Number.MAX_SAFE_INTEGER,b)

    I went the opposite direction and tried for very terse with only 3 arrow functions and a constant.

    In mine ...
    isPolydivisible works for arbitrary length strings but might be limited by the stack size since it is recursive
    getPolydivisible will break if the result is greater than Number.MAX_SAFE_INTEGER
    also there is no error checking so it relies on appropriate inputs

    Its always fun to see the many different ways people solve katas

  • Loading more items...