Ad
  • Custom User Avatar

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

  • Custom User Avatar

    I would suggest having a test case where the numeric value is zero, to cover the edge case.

    Test.expect((0).twos(8) === '00000000', '0 in 8 bits == 00000000');
    
  • Custom User Avatar

    This solution fails for numeric values of 0. The ternary operator should have this>=0 or have this<0 and the last two arguments swapped.

  • Custom User Avatar

    The description does not mean to take the integer portion, it means the absolute value (i.e. if it's negative, treat it like it is positive). The absolute value of -257.8333333333333 is 257.8333333333333, not 257.

  • Custom User Avatar

    There are a lot of strange criteria that seem to be tacked on to the problem and seem to not really add much, and just point the coder to a specific set of solutions, rather than making it more challenging or thought provoking.

  • Custom User Avatar

    I would suggest having a perfect square number as one of the test cases during final submission, because I was able to create a solution that passed all of the cases, but fails for primes (it duplicates the square root in the output)