I would like to know how to get array of object values based on object value match
using javascript
how to get only array of objects having the type AM
and N
by comparing with object
value
var result = list.filter(e=>e.type==="AM" && "N");
how to compare with object instead of direct value
var list =[
{id:1, name: "abc", type:"AM", valid:"yes"},
{id:2, name: "xyz", type:"AM", valid:"yes"}
{id:3, name: "zen", type:"N", valid:"no"}
{id:41, name: "lisa", type:"PM", valid:"no"}
]
var obj={
shiftmrn: "AM",
shiftnoon: "N",
shiftnight: "PM",
noshift: "NIL"
}
Expected Output
[
{id:1, name: "abc", type:"AM", valid:"yes"},
{id:2, name: "xyz", type:"AM", valid:"yes"},
{id:3, name: "zen", type:"N", valid:"no"}
]