This is my query ,
var id = [1,2];
var oparr = [{
"off": [{
id: 1,
val: "aaa"
},
{
id: 3,
val: "bbb"
}
]
},
{
"off1": [{
id: 2,
val: "cccc"
}]
}
];
from the above oparr array I need to find with id array, I need this result
var arr = {
finalval: [
{
id: 1,
off: true,
off1: false
},
{
id: 2,
off: false,
off1: true
}]
}
If the id is in off[0] I need set off1 as true and off2 as false.
I tried with underscore js indexof , find , findWhere but I didn't get the desired result format.
offandoff1only ) or are we expecting more?