Given the following two array objects:
let origArr = [ { value: 2, label: 'Dog' },
{ value: 4, label: 'Cat' },
{ value: 16, label: 'Horse' }
]
let newArr = [
{ value: 2, label: 'Dog' },
{ value: 3, label: 'Bird' },
{ value: 0, label: 'Fish' }
]
what would be the best way to return a new array of just the value of the difference between the origArr
and the newArr
, that is, where origArr
element(s) are not in newArr
?
In the above example, I am after a new array called diffArr = [4,16]
Please note: that all value
values within both origArr
and the newArr
are unique
Not sure if there is an ES2016 means?