// if length is not the same then must not be equalif(a.length!= b.length)returnfalse;

// do an initial sort which will group types a.sort(); b.sort();

for(var i =0; i < a.length; i++){

// if primitive then comparison will doif(isPrimitive(a[i])&& isPrimitive(b[i])){

if(a[i]!= b[i])returnfalse;}// if not primitive then we will need to check for obj refelseif(!isPrimitive(a[i])&&!isPrimitive(b[i])){if(!a[i].__aCount) a[i].__aCount =0;if(!b[i].__bCount) b[i].__bCount =0; a[i].__aCount = a[i].__aCount +1; b[i].__bCount = b[i].__bCount +1;}// if both types are not the same then this array// contains different number of primitiveselse{returnfalse;}

}for(var i =0; i < a.length; i++){if(!isPrimitive(a[i])){if(!a[i].__aCount){returnfalse;}if(!a[i].__bCount){returnfalse;}if(a[i].__aCount != a[i].__bCount){returnfalse;}}}// if it gets this far it must be the samereturntrue;}

// testing if nulls and nans are the same everywherefor(var i =1; i < al; i++)if(nulls[i]!= nulls[0]|| nans[i]!= nans[0])returnfalse;

// testing if primitives were the same everywherevar map0 = maps[0];for(var el in map0)for(var i =1; i < al; i++){if(map0[el]!== maps[i][el])returnfalse;delete maps[i][el];}for(var i =1; i < al; i++)for(var el in maps[i])returnfalse;

if(a[i]!= b[i])returnfalse;}// if not primitive then we will need to check for obj refelseif(!aIsPrimitive &&!bIsPrimitive){ incrementCount(a[i]); incrementCount(b[i]); objs.push(i);}// if both types are not the same then this array// contains different number of primitiveselse{returnfalse;}

}for(var i =0; i < objs.length; i++){var even = a[objs[i]].__count %2===0;if(!even){returnfalse;}}// if it gets this far it must be the samereturntrue;}