only check once for the existance of indexOf prototype

Rather than evaluating what to do each time arrayIndexOf is executed, make the decision of what method to use once.