Ad
  • Custom User Avatar

    If this one is an alligator (case-insensitive)

    Because of that.

  • Custom User Avatar

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

  • Custom User Avatar

    Nice kata. I have a translation in Scala that is currently 147 characters long - remarkably short for a strongly typed language. If you allow a Scala translation, I will put it in.

  • Custom User Avatar

    There's assertEquals method for equality. If you want to use assertSimilar, it seems to resemble behaviour of the Object.is, described in ECMA-262 secion 7.2.9

  • Custom User Avatar

    It appears that Test.assertSimilar() has an issue with comparing negative and positive zeros in javascript.

    By definition in ECMA-262 Section 7.2.14 -0 === +0 === true.

    The comparison x === y, where x and y are values, produces true or false. Such a comparison is performed as follows:

    1. If Type(x) is different from Type(y), return false.
    2. If Type(x) is Number, then
    3. If x is NaN, return false.
    4. If y is NaN, return false.
    5. If x is the same Number value as y, return true.
    6. If x is +0 and y is -0, return true.
    7. If x is -0 and y is +0, return true.
    8. Return false.
    9. Return SameValueNonNumber(x, y).

    However, the Test.assertSimilar() method fails for the following test.

    Test.assertSimilar([-0], [0]);
    // => Expected: '[0]', instead got: '[-0]'
    
  • Custom User Avatar

    I'm getting the same error in my tests. I wonder why this is happening when -0 === 0 returns true in javascript.