Javascript Get Maximum Value In Array Condition