Linked Questions
12 questions linked to/from Delete duplicate elements from an array
2918 votes
94 answers
3.7m views
Get all unique values in a JavaScript array (remove duplicates) [duplicate]
I have an array of numbers that I need to make sure are unique. I found the code snippet below on the Internet, and it works great until the array has a zero in it. I found this other script here on ...
2538 votes
51 answers
3.4m views
Remove duplicate values from a JavaScript array
I have a very simple JavaScript array that may or may not contain duplicates. var names = ["Mike","Matt","Nancy","Adam","Jenny","Nancy",&...
8 votes
3 answers
12k views
Mongoose: Returning unique result set with no duplicate entries
I am using Mongoose in a MEAN environment. How can I make sure to not have any duplicate results in my result set? Example: my database contains 10 (partly duplicate) names: Allan Allan Fourier Allan ...
4 votes
4 answers
6k views
Remove duplicates from array in typescript
I am new to typescript, and i've been having some problems in using my javascript skills. For example, can someone help me to write this exactly same javascript code below in typescript? If not ...
0 votes
2 answers
4k views
In TypeScript I want distinct values from comma separated duplicate string:
In TypeScript I want distinct values from comma separated duplicate string: this.Proid = this.ProductIdList.map(function (e) { return e.ProductId;}).join(','); this.Proid = "2,5,2,3,3"; And I need : ...
2 votes
6 answers
4k views
How to stop duplicate values in a loop?
I am using this code to read all the values from each object with the key "category": const listChapter = datas.map((data) => console.log(data.category)) datas is an array of Objects, and there ...
2 votes
3 answers
1k views
How to only allow unique string literal in array [duplicate]
export interface IGUser { biography: string; id: string; ig_id: string; followers_count: number; follows_count: number; media_count: number; name: string; profile_picture_url: string; ...
0 votes
1 answer
1k views
How to remove duplicate objects from an array based on more than one criteria [duplicate]
I am trying to find duplicate objects from array by camparing more than 1 field inside object. I want to compare 2 fields of the object with the other objects of the same array. I want to campare ...
0 votes
4 answers
419 views
How to remove duplicates from array in javascript
I have put a general title for a good search, but my question is a bit more specific. I have got one array: var keywords= ["Anglo-Saxon English","American English","British English","Canadian ...
1 vote
3 answers
598 views
NodeJS: Extracting duplicates from Array
I'd need your help... I'm sorry if the question has already been asked but I can't seem to find a suitable answer for my problem: I'm trying to extract (not remove) the list of the duplicates from my ...
-1 votes
3 answers
173 views
How to find whether there exists an object in json[] based on a particular field value using javascript
I hava a json object as var arr=[{"id":"1","ref":"100"},{"id":"2","ref":"200"},{"id":"3","ref":"100"}] Now I have a function such that a new json object is passed ex.{"id":"4","ref":"400"},then I ...
-1 votes
2 answers
176 views
How to avoid duplicate items in a drop down list to display?
I would like to create a drop-down list and retrieve the elements from a webService. My problem is that I would like to avoid displaying duplicate items because I have 9999 items. Here is the JSON ...