Ad
  • Custom User Avatar

    the question states that anything other than a numbers should add 0, now when an array only have NaN the expected output in my view is 0 as its not a number and cannot be added.

    could the tests be changed or requirement be specified more clearly?

    Also it looks like a pattern where you are passing NaN or null the expected output in the test becomes NaN instead of the sum of other numbers

    In the current test it expects an output of NaN.
    Ex: 1
    initial array [ NaN ]
    Expected: NaN, instead got: 0

    Ex: 2
    initial array [ NaN, 6, {}, 67, 934 ]
    total 1007 binary 1111101111
    Expected: NaN, instead got: 1111101111
    but if we add all the numbers above we get 1007, i am not sure if i am missing anything here.