当前位置:网站首页>Data De duplication - complex data types
Data De duplication - complex data types
2022-04-23 00:08:00 【Houdu】
Complex data type de duplication
let arr = [
{
name: " Zhang San ",
xxx: "xxx"
},
{
name: " Zhang 4",
xxx: "xxx"
},
{
name: " Zhang 51",
xxx: "xxx"
},
{
name: " Zhang San ",
xxx: "xxx"
},
{
name: " Zhang 4",
xxx: "xxx"
},
{
name: " Zhang 5",
xxx: "xxx"
},
{
name: " Zhang 51",
xxx: "xxx"
},
{
name: " Zhang 6",
xxx: "xxx"
},
{
name: " Zhang 5",
xxx: "xxx"
},
]
// Complex data type de duplication
function quc(arr) {
let o = [];
for (let i = 0; i < arr.length; i++) {
const eleI = arr[i];
// Subscript of matching condition No match Namely -1 If it matches, it's not -1
let oi = o.findIndex((ite) => {
return ite.name == eleI.name;
});
if (oi == -1) {
o.push(eleI);
}
}
return o;
}
console.log(quc(arr));
版权声明
本文为[Houdu]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204222212485121.html
边栏推荐
猜你喜欢

YASKAWA motor servo software sigmawin + cannot be connected to the servo driver

Algorithm -- adding two numbers II (kotlin)

BGP basic configuration

Some understanding of image receptive field

Programming 2022-02 KTV

Swin Transformer网络架构、相应改进模块的理解

What are the interfaces of the switch? The article takes you to remember its name and function

教你两分钟做出一个精美好用的404页面

The implementation principle and function of closure and memory leakage

Day81 (dynamic programming, cross tree traversal)
随机推荐
获取当前选中字符串的范围
2022-4-22 job MySQL single table query
L1-080 multiplication formula sequence (20 points)
解决工业缺陷检测小样本问题
Bonner ultrasonic sensor t30uxda
Q: How to mark data points on the image of MATLAB? & Text function elaboration
What if the website is attacked by DDoS?
Change the pycharm interface to Chinese and switch between Chinese and English
【ACM】78. Subset (return elements of all nodes without setting termination conditions)
B端/C端中,产品or运营哪个更重要?
Detailed explanation of seven common query connections in MySQL
常见的社群玩法盘点,你做的是哪一种?
API接口知识小结
目标检测模型回归anchor偏移量等问题
Q:MATLAB的图像上怎么标记数据点?&Text函数精讲
Algorithm -- adding two numbers II (kotlin)
力扣习题集2--两数相加
Data type not supported by ice's mice profiler
A convnet for the 2020s summary
AcWing 1842. Milk bucket traverses all situations