Javascript Array Reduce Method Javascript Interview Question