I have array of object and object in which have to
check the arrobj
code
and objvalue
are same,if above condition ok, then check the obj
idtype
and arrobjcode
is same or obj.idtype value exists then return array list or return []
of object in javascript
var arrobj = [
{id:1, code: "brown", type: "FR"},
{id:3, code: "black", type: "SP"},
{id:4, code: "blue", type: "FR"}
]
var obj={
id:20, idtype: "SG", value: "blue"
}
Expected Output
// arrobj.code and obj.value matches, obj.idtype and arraobj.type not same
[]
var arrobj2 = [
{id:1, code: "brown", type: "FR"},
{id:3, code: "green", type: "SP"},
{id:4, code: "blue", type: "FR"},
{id:5, code: "blue", type: "SG"}
]
var obj2={
id:20, idtype: "SG", value: "blue"
}
Expected Output
// arrobj.code and obj.value matches, obj.idtype value exists in arraobj.type
[
{id:4, code: "blue", type: "FR"},
{id:5, code: "blue", type: "SG"}
]