I'm not sure I follow.
Currently, it will only "try" so long as i < array.length, Other wise
we throw an error.
The loop breaks and returns an instance on which ever attempt is
successful.

Here's an example w/ the standard XMLHttpRequest as 3rd in the array.
This shold find a working instance after 3 attempts.  As it does.

http://jsfiddle.net/jiggliemon/b5LaZ/2/



On Jul 31, 1:52 am, Sanford Whiteman <[email protected]>
wrote:
> > I moved the return back into the Try, and it works.  For what ever
> > reason, it didn't work before, works now.
>
> Well, with your refactoring, you changed the scope chain around.
>
> But  your  new  version attempts to instantiate at least 1 unnecessary
> object  and  possibly  well  more  than i^2 extra ones, where i is the
> index where the match is found. The recursion is kinda out of control.
>
> The   previous  version  just  straightforwardly  tried  a  max  of  n
> instances, where n is the number of possible object types.
>
> -- S.

Reply via email to