当前位置:网站首页>数据去重-复杂数据类型
数据去重-复杂数据类型
2022-04-22 22:13:00 【厚渡】
复杂数据类型去重
let arr = [
{
name: "张三",
xxx: "xxx"
},
{
name: "张4",
xxx: "xxx"
},
{
name: "张51",
xxx: "xxx"
},
{
name: "张三",
xxx: "xxx"
},
{
name: "张4",
xxx: "xxx"
},
{
name: "张5",
xxx: "xxx"
},
{
name: "张51",
xxx: "xxx"
},
{
name: "张6",
xxx: "xxx"
},
{
name: "张5",
xxx: "xxx"
},
]
// 复杂数据类型去重
function quc(arr) {
let o = [];
for (let i = 0; i < arr.length; i++) {
const eleI = arr[i];
// 匹配条件的下标 没有匹配上 就是 -1 匹配上了就不是 -1
let oi = o.findIndex((ite) => {
return ite.name == eleI.name;
});
if (oi == -1) {
o.push(eleI);
}
}
return o;
}
console.log(quc(arr));
版权声明
本文为[厚渡]所创,转载请带上原文链接,感谢
https://blog.csdn.net/dwp_wz/article/details/124323189
边栏推荐
- SecureCRT v7. 0 failed to connect to sshd service. Solution
- Lecture recording and broadcasting | subgraph matching algorithm in graph database - Zou Lei
- opcua协议如何在appinventor上使用?
- 2.56-试着用不同的示例值来运行show_bytes的代码。
- Hydraulic shock analysis of haWe haWe hydraulic pump station
- appinventor拓展开发
- 【微信小程序开发(云壁纸小程序教程)】
- Reinforcement learning (practice): dqn, double dqn, dueling dqn
- 并发的可达性分析(三色标记法)
- 对象大小与指针压缩--JVM
猜你喜欢

并发的可达性分析(三色标记法)

Saiweidian broke on the first day of listing: the market value evaporated by more than 1.5 billion yuan, and the business scale lost slightly

A simple and easy-to-use file upload scheme

51 MCU proteus simulation key control nixie tube digital display

Rasa课程、Rasa培训、Rasa面试、Rasa实战系列之Rasa全新全局词槽映射的 3 大方法

外部中断---------stm32f407zet6

JVM性能调优1

【洛谷】P1162 填涂颜色(bfs)
![[wechat applet development (cloud wallpaper applet tutorial)]](/img/71/d1ec9b0e7af47427c1e19b9b949bfa.png)
[wechat applet development (cloud wallpaper applet tutorial)]

What is the magic of moonbirds NFT, which became popular overnight?
随机推荐
2.57-编写程序show_short, show_long和show_double,它们分别打印类型为short, long和double的C语言对象的字节表示。请试着在几种机器上运行。
安装AuthorizationPolicy和EnvoyFilter
【微信小程序开发(云壁纸小程序教程)】
repeat_map mp.find() + mp.erase()
2.60-假设我们将一个w位的字中的字节从0(最低位)到w/8- 1(最高位)编号。写出下面C函数的代码,它会返回一个无符号值,其中参数x的字节i被替换成字节b。
输入一行字符,单词之间用一个空格分隔,统计其中有多少个单词
[wechat applet development (cloud wallpaper applet tutorial)]
Enter a line of characters, separated by a space between words, and count how many words there are
浅谈细说构造函数
41.0:GemBox. Spreadsheet|. Document|. Pdf|. Presentation
LeetCode 199. 二叉树的右视图
On the law of enterprise informatization
学习笔记2-0417
小赛毛游C记——初识C语言(3)
Catering industry cashier system source code, C # Net + MSSQL WPF
cluster_acc计算
时间戳有什么作用,如何申请?
MySQL表的增删改查(进阶)
知识表示之知识图谱的图和数值表示
GBase 8s V8.8 SQL 指南:教程-6.2