function arraysSimilar(arr1, arr2){
var count = 0;
if (arr1.length === arr2.length) {
arr1.forEach(function (x) {
switch(typeof x) {
case "number":
case "string":
case "boolean":
case "undefined":
case "function":
var result = arr2.some(item => (typeof item) === (typeof x));
if (result === true) {
count++;
}
break;
case "object":
var result = objRec(x);
result = arr2.some(item => item === result);
if (result === true) {
count++;
}
break;
}
});
if (count === arr1.length) {
return true;
}
else {
return false;
}
}
return false;
}
function objRec(x) {
if (x === null) {
return null;
}
else if (x instanceof Date) {
return Date;
}
else if (x != null && x === x.window) {
return window;
}
}