You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function removeDuplicates(arr) {
var result = {}; // 用于存储唯一对象的空对象
for (var i = 0; i < arr.length; i++) {
var objKey = JSON.stringify(arr[i]); // 将对象转换为字符串作为键
if (!result[objKey]) {//如果该键的值为空
result[objKey] = arr[i]; // 将对象添加到新的对象中作为该键的值
}
}
return Object.values(result); // 返回唯一对象的值作为去重后的数组
}
The text was updated successfully, but these errors were encountered: