[Javascript] object sort fails in IE

Hassan Schroeder hassan at webtuitive.com
Mon Apr 19 14:39:31 CDT 2004


Flavio Gomes wrote:

> Check your code:
>  if ( a.labelString < b.labelString ) { result = 1; }
>  if ( b.labelString > a.labelString ) { result = -1; }
> 
> Shouldn't it be:
> 
>  if ( a.labelString < b.labelString ) { result = 1; }
>  if ( a.labelString > b.labelString ) { result = -1; }
> 
> You reversed the "<" and the order of "a" & "b" should've reversed only one
> of them.

Oh, dear. You're absolutely right. How did I miss that? And why did
it seem to work properly in Moz?! That's a wierd one...

Good eyes -- thanks much!

-- 
Hassan Schroeder ----------------------------- hassan at webtuitive.com
Webtuitive Design ===  (+1) 408-938-0567   === http://webtuitive.com

                           dream.  code.





More information about the Javascript mailing list