Ad
  • Default User Avatar

    With all due respect, you are not right. Function squareSum() takes one argument, not two. Let me explain: func squareSum([],[1,2,2]) will only look for a first argument, which is [] (empty array), and thus result is 0. Also, if you would to call func squareSum([1,2,2], []), the result would be, as expected, 9.

  • Custom User Avatar

    The squareSum function takes in one single argument, an array of numbers. Your example calls squareSum with two arguments, which is not part of the spec. Not a kata issue.

  • Custom User Avatar

    squareSum([], [1,2,2]) returns 0 which is fundamentally WRONG!
    It should be 9! even after you initialize the default value of reduce to 0 or []
    The issue lies within Javascript limitations.

  • Custom User Avatar

    add 0 or [] to reduce, (sum, 0) for example. this Excercise is fundamentally wrong because it returns purposefully zero when given and empty array so, don't be upset about this challenge.

  • Custom User Avatar

    None of these functions solve the problem; for example
    squareSum([],[1,2,2]) returns zero, which is WRONG!
    it should return 9 and not 0!!!!