Javascript Array Reduce Initial Value Solver