if you are really concerned about performance I would recommend to
hash values added to the array into common hash and then comparing two
arrays would take only O(1) not O(n)

Andrii Olefirenko

--- In [email protected], "Sergey Kovalyov"
<[EMAIL PROTECTED]> wrote:
>
> What is the best way to compare two arrays element by element
ignoring the
> order? My solution:
> 
> var differs : Boolean =
>  (a.length != b.length) ||
>  a.some(
>   function(item : Object, index : int, array : Array) : Boolean {
>    return (b.indexOf(item) == -1);
>   });
> 
> May be the better solution exists?
>


Reply via email to