How to get different values from 2 object arrays using underscore js. I have 2 object arrays like this
var a = [{
"asset_id": 1,
"asset_type": 2
}, {
"asset_id": 1,
"asset_type": 3
}, {
"asset_id": 3,
"asset_type": 3
}, {
"asset_id": 5,
"asset_type": 2
}, {
"asset_id": 9,
"asset_type": 3
}, {
"asset_id": 10,
"asset_type": 3
}];
var b = [{
"asset_id": 1,
"asset_type": 2
}, {
"asset_id": 1,
"asset_type": 3
}, {
"asset_id": 3,
"asset_type": 3
}];
My result should be like this
[{
"asset_id": 5,
"asset_type": 2
}, {
"asset_id": 9,
"asset_type": 3
}, {
"asset_id": 10,
"asset_type": 3
}]
Is there any inbuilt functions to this in underscorejs
as andbs to be within your result? Your result looks like it's just picking the last 3 items form arraya.aandb. It's probably worth correcting that.