Ruby Array Reduce Method Javascript Tutorial