This is unrelated to sorting in the teambuilder, and should go in a different pull request, or at the very least in a different commit.

Also, never use `!=` for strings. That should be `typeof(BattlePokemonSprites) !== 'undefined'`

Also, `typeof` isn't a function. It should be written `typeof BattlePokemonSprites !== 'undefined' `

Also, `typeof` is inefficient for detecting existence. PS standard is to use `window.BattlePokemonSprites`