Linked Questions
22 questions linked to/from Compare two Javascript Arrays and remove Duplicates
4
votes
5
answers
518
views
Removing duplicates from a Array [duplicate]
I am dealing with the following problem from my data structure book. I have come up with the solution as suggested by this text . I basically found all the duplicates and labelled them some arbitrary ...
2
votes
0
answers
45
views
Splice method not removing the correct elements. JavaScript [duplicate]
I am supposed to write a function that passes two arrays, a and b, and removes elements from 'a' that are found in 'b'.
This is my code
function array_diff(a, b) {
for( var i = 0; i < b.length; ...
5
votes
2
answers
28k
views
compare two arrays and return duplicate values
How may I retrieve an element that exists in two different arrays of the same document.
For example. In Posts collection, document has the fields 'interestbycreator' and 'interestbyreader.' Each ...
3
votes
4
answers
4k
views
How to Subtract Multiple Objects from an Array with Another array
I'm trying to subtract, i.e. remove, multiple objects, namely the objects of array2 found in array1 so that the end result is that array2 only contains the "jean" object.
Help! I'm lost.
I tried ...
0
votes
4
answers
1k
views
Find and remove object from array of objects
I have 2 arrays of objects.
Array1:
[{ id: 2, ref: 1010101 },
{ id: 2, ref: 1010107 }]
Array2:
[{ id: 2, ref: 10010001 },
{ id: 2, ref: 10010002 },
{ id: 2, ref: 10010003 },
{ id: 2, ref: ...
-3
votes
5
answers
2k
views
How to compare two objects and remove the duplicate objects by value in javascript
I am having two objects i would like to compare those objects and remove the duplicate objects by value and show the rest of the objects.I have tried lodash omit but it doesn't works.
let users = ...
-6
votes
1
answer
2k
views
How to get duplicate records in two object array of JSON using jQuery
My first Json Array is like :
[
{"Invent":"4","Beze":"256","mail":"[email protected]"},
{"Invent":"4","Beze":"261","mail":"[email protected]"},
{"Invent":"4","Beze":"260","mail":"[email protected]"},
{"...
0
votes
5
answers
902
views
Comparing two arrays and getting out missing/wrong items
I have little problem with Js arrays. I have two arrays - one is correct all the time (created with correct data) and one is coming from fetching basically. I'm trying to compare these two arrays and ...
1
vote
2
answers
459
views
Compare 2 arrays and return true or false
I am kinda new to Javascript and I cant figure out how to do this.
So , I have this ( from csv file ) array1
[{...}, {...}, {...}, {...}, {...}, {...}, {...}]
0: {Number: 1}
1: {Number: 2}
2: {Number: 3}
3: {...
1
vote
2
answers
446
views
How to Slice array Elements that is already present in another array in JavaScript/Jquery [duplicate]
I have 2 arrays of time string. i want to remove elements of arr1 that is already presented in arr2.
These are my arry :
arr1 = ["05:30", "05:45", "06:00", "06:15", "06:30", "06:45", "07:00", "07:...
0
votes
2
answers
238
views
How to correctly use 'async, await and promises' in nodejs, while allocating values to a variable returned from a time-consuming function?
Problem Statement:
Our aim is to allocate values in the array ytQueryAppJs, which are returned from a time consuming function httpsYtGetFunc().
The values in ytQueryAppJs needs to be used many times ...
-2
votes
2
answers
222
views
Duplicate values removal using Javascript [duplicate]
var arr1=["a","b","b","c","c","d"];
var arr2=["b","c",];
arr1 has duplicate values which are listed in arr2.
Now I want to remove the duplicate values from arr1 using arr2. Is it possible?
0
votes
3
answers
294
views
Javascript: Remove duplicates in an array by compare function
I have an array with objects like this:
const array = [
{name:'obj1', address: 987, id: '123', location: 'zyx' },
{name:'obj2', address: 654, id: '456', location: 'wvu'},
{name:'obj3', ...
0
votes
1
answer
176
views
Remove duplicates from two separate arrays javascript
I am working on the roleUpdate event on my Discord bot, I have old role permissions, and new role permissions in the form of an array which prints:
[ 'VIEW_AUDIT_LOG', 'MANAGE_ROLES' ] // Old Roles
[ ...
0
votes
1
answer
189
views
Empty array getting logged in, in nodeJs
Flow:
The user submits a queryValue in index.html.
Three API calls are made (using a function called ytAxiosGetFunc) based on the queryValue.
The returned values are put in three arrays: ytQueryAppJs,...