Ad
  • Custom User Avatar

    It has to do with the way that functions are called. If you substitue the addOne(3) with the value assigned to it, you get:

    var addOne = add(1); addOne(3) equals add(1)(3);

    So the call passes the arguments in the set order.

  • Default User Avatar

    this assumes that there should be exacly 1 occurrence of each number always. the kata description doesn't say that just that it needs to have all elements from 0 to 9.

  • Custom User Avatar

    The reduce function just takes a collection of values and returns a single value out the end, depending on the function you provide on the inside. In a nut shell, it starts out with what the answer should be, and subtracts the values that are given. In then end, the missing value is what is popped out the other end of the reduce.