javascript数组对象去重
arr 为要去重的数组对象
var result = [];
var obj = {};
for (var i = 0; i < arr.length; i++) {
if (!obj[arr[i].umNo]) {
result.push(arr[i]);
obj[arr[i].umNo] = true;
}
}
arr 为要去重的数组对象
var result = [];
var obj = {};
for (var i = 0; i < arr.length; i++) {
if (!obj[arr[i].umNo]) {
result.push(arr[i]);
obj[arr[i].umNo] = true;
}
}
发表评论 (审核通过后显示评论):