compare two arrays and take values from the first array not contained in the second array
I have this array with 3 of size
[
'decdbaf8-db89-4d4b-973a-e8edab55927c',
'c553c2f7-eff6-476e-b718-2814a7fa5435',
'8717092f-5820-474b-9dd9-165e2649180f'
]
and this array with size equals 2:
[
{
id: 'c553c2f7-eff6-476e-b718-2814a7fa5435',
name: 'test',
codReference: '15422aa',
category_id: '7a026a80-f3d2-462a-ad5d-598e9eabf693',
created_at: 2020-10-29T22:23:35.928Z,
updated_at: 2020-10-29T22:23:35.928Z,
deleted_at: null
},
{
id: 'decdbaf8-db89-4d4b-973a-e8edab55927c',
name: 'test',
codReference: '2',
category_id: '7a026a80-f3d2-462a-ad5d-598e9eabf693',
created_at: 2020-10-29T22:23:37.784Z,
updated_at: 2020-10-29T22:23:37.784Z,
deleted_at: null
}
]
I know that if I were to get only one item that is not contained in the array, I would just use: indexOf (value)> -1;
but how can I compare the two arrays and get only the values of the first array that are not contained in the second array
from Recent Questions - Stack Overflow https://ift.tt/3jD2UaJ
https://ift.tt/eA8V8J
Comments
Post a Comment