(3) |
(3) |
(5) |
(1) |
(5) |
(9) |
(7) |
(9) |
(5) |
(2) |
(1) |
(8) |
(7) |
(4) |
(17) |
(5) |
|
Location |
United States |
|
IP Address |
18.97.14.87 |
|
2024. 12 |
1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | | |
|
|
Category |
Languages, JavaScript |
Writer |
김태우 |
Date |
2014-03-24 19:30:03 |
Visit |
2388 |
isEqualsArray |
|
Javascript Function, isEqualsArray
배열 비교
function isEqualsArray(arr1, arr2) {
if (!arr1 || !arr2)
return false;
if (arr1.length != arr2.length)
return false;
for (var i = 0; i < arr1.length; i++) {
if (arr1[i] instanceof Array && arr2[i] instanceof Array) {
if (!isEqualsArray(arr1[i], arr2[i]))
return false;
} else if (arr1[i] instanceof Object && arr2[i] instanceof Object) {
if (Object.keys(arr1[i]).length != Object.keys(arr2[i]).length)
return false;
for (var key in arr1[i]) {
if (arr1[i][key] != arr2[i][key]) {
return false;
}
}
} else if (arr1[i] != arr2[i]) {
return false;
}
}
return true;
}
|
|
Tags |
배열 비교, isEqualsArray, Object.keys |
Relation Articles
|