Linked Questions
14 questions linked to/from Completely removing duplicate items from an array
6 votes
5 answers
4k views
remove all elements that occur more than once from array [duplicate]
Before people think this is the same as all these other answers on Stack Overflow regarding removing duplicates can you please look at what is returned as opposed to what I am looking to do. I want ...
4 votes
1 answer
3k views
How to return the only value that is not repeated in this Array? [duplicate]
I have a question in Javascript. This is the following Array: [1,0,0,0,0,0,0] I would like to return the only value that does not repeat, that is, 1. Any suggestions? I have this: var result = ...
-2 votes
1 answer
670 views
Javascript how to get non duplicates data from array? [duplicate]
let getNonDuplicates = [1,2,3,4,2,3,4,5]; // Here's my example array the result I needed is to get 1 & 5 since those are the data that don't have duplicates let resultMustBe = [1,5];
0 votes
1 answer
1k views
find Non-duplicate element array in javascript with filter method [duplicate]
i wanna find Non-duplicate element array in javascript with filter method. for example: const number = [1,2,1,3,4,5,3]; i wanna find 2,4,5 in array please help me
-1 votes
3 answers
202 views
Exclude duplicates from array [duplicate]
I am trying to exclude duplicate numbers from the array. For example: if I filter an array of [1,2,2,3,5,5] the output should be [1,3]. function unique(arr) { let sortArr = arr.sort() let res = [] ...
1 vote
3 answers
80 views
Javascript - Convert one Array into two after Group-by in [duplicate]
I have array like below myArray = ["foo", "bar", "foo", "bar", "bar", "bar", "zoom"] I want output like this nameArray = ["foo", "bar", "zoom"] and qtyArray = [2, 4, 1] I will be using Plotly out ...
1 vote
3 answers
117 views
Filtering an array for only unique values [duplicate]
for example if arr = [1,1,2,3,5,5] this will return [1,2,3,5]. function returnUnique(arr) { let unique = [...new Set(arr)]; return unique; }; my goal is to return only 2,3
0 votes
3 answers
64 views
Get the unique value from 3 or more arrays [duplicate]
In this case I have 3 arrays in javascript: var array1 = ['124','10','100','190','1000']; var array2 = ['124','100','190', '45']; var array3 = ['124','100','175','19','1900']; I need a script that ...
-4 votes
1 answer
66 views
Retrieve unique elemens from an array using js [duplicate]
var arr = [1, 1, 1, 5, 3, 4, 6, 6] function uniqueRetriever(bla, boi) { ... } var unique = uniqueRetriever(bla, boi) console.log(unique); //output: [5, 3, 4] How do I retrieve unique elements from ...
0 votes
1 answer
63 views
Drop all duplicates from array using JavaScript [duplicate]
I have an array of objects with input like below var jsonArray1 = [{id:'1',name:'John'},{id:'2',name:'Smith'},{id:'3',name:'Adam'},{id:'1',name:'John'}] The id 1 appears twice and I would like to ...
1 vote
0 answers
51 views
How to remove same value if it has in an array? [duplicate]
Ho do I remove same values in an array has? example code: const array = [10, 20, 30, 40, 20, 70, 10 ] Expected output: const outputArray = [30, 40, 70]; I can remove the duplicate value. But how to ...
0 votes
0 answers
33 views
How to return array element with no duplicate ?? Javascript solution [duplicate]
We have a array of numbers. let's say const num = [ 10, 12, 4, 3, 5, 5, 10, 12 ]; Element with no duplicate is 4 and 3 in the 'num' array. So function should return array such elements. It would be ...
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",&...