Ad
  • Custom User Avatar

    My solution passes those. But fails one in the final run. (the first one)

  • Custom User Avatar

    Not an issue

  • Default User Avatar

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

  • Custom User Avatar

    Here are the ones I wrote if they help:

    const sqr = once((x) => { return x * x})
    Test.assertEquals(sqr(3), 9)
    Test.assertEquals(sqr(5), undefined)

    const add = once((a,b) => { return a + b })
    Test.assertEquals(add(1,2), 3)
    Test.assertEquals(add(5,9), undefined)
    Test.assertNotEquals(add(1,2), 3)

  • Custom User Avatar

    Yep. Your function returns undefined and the tests pass it as the argument to your function again.
    Using push on undefined causes the error.

  • Custom User Avatar

    Why have you commented out the return statement? Your function should return the array after appending to it.

  • Default User Avatar

    If you have [].reduce(fn) instead of [].reduce(fn,0) with empty arr you will get that error.

  • Default User Avatar

    Maybe if you post your code, we can provide some more helpful comments. As it stands, I'm not sure what you mean.