<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb18030">
<title>Untitled Document</title>
</head>
<body>
<script type="text/javascript">
/*
* param1 Array
* param2 Array
* return true or false
*/
function arraysSimilar(arr1, arr2){
var arr1_type=new Array();
var arr2_type=new Array();
if(arr1.length=arr2.length){
for(var i=0;i<arr1.length;i++){
arr1_type[i]=gettype(arr1[i])
arr2_type[i]=gettype(arr2[i]);
}
}
arr1_type.sort();
arr2_type.sort();
type1=arr1_type.join();
type2=arr2_type.join();
if(type1==type2){
return true;
}else{
return false;
}
}
function gettype(item){
var Type=typeof item
if(Type=object){
return Type;
}else if(item instanceof Date){
Type="Date"
}else if(item===window){
Type="window";
}else if(item===null){
Tyep="null"
}else if(item instanceof Array){
Type="Array"
}else {
Type="obejct"
}
return Type;
}
</script>
<script src="testData.js"></script>
</body>
</html>