Оптимальный вариант )))
function compare(arr1, arr2){
if(arr1.length !== arr2.length) return false;
arr1.sort();
arr2.sort();
var i = arr1.length;
while(i--) if(arr1[i] !== arr2[i]) return false;
return true;
};
var a = ['a','b','c','c'], c = ['b','c','a','a'], d = ['b','c','c','a'];
alert([compare(a,c),compare(a,d)]);