Ruby Array Reduce Method Javascript Array Find