Ad
  • Default User Avatar

    I have used array.filter before. But I just started so would someone please explain this kata and the solution for those new to programming?
    I would like to learn something from this but the solutions are not clear to me.

  • Default User Avatar

    I am sure that link answers my question...somewhere?

    Nevertheless, I appreciate the reply. Sorry about posting in the wrong area.

  • Custom User Avatar

    Don't ask kata-related questions here, go to the kata's discourse and ask their plss next time ~~~~

    And read this to clarify your doubts ~~

  • Default User Avatar

    I hope that this is the correct place to ask. If not, I am sorry for the hassle. On the 8 Kyu kata "Sum of positive," you are to get an array of numbers and return the sum of all of the positive ones. I tried this:

    function positiveSum(arr) {
    return arr.filter(e => e > 0).reduce((a, b) => a + b);
    }

    It worked using node in VS Code, but in Codewars, I received a TypeError.

    Could someone please tell me what I have done wrong?