I have a booking array of arrays that contain objects and I have to search inside the array using searchValue
could you please help me here
here we have to check the booking id if booking id and searchValue matched we have to push that object into result array.
let bookingArr = [
[{
name: "user 1",
bookingid: 10,
product: "ab"
},
{
name: "user 1",
bookingid: 10,
product: "cd"
}
],
[{
name: "user 2",
bookingid: 11,
product: "ui"
},
{
name: "user 1",
bookingid: 10,
product: "ef"
}
],
[{
name: "user 3",
bookingid: 12,
product: "ui"
},
{
name: "user 4",
bookingid: 13,
product: "ef"
}
]
];
var searchValue = "10,11";
var FOUND = bookingArr.find(function(post, index) {
if (post.bookingid == 11)
return true;
});
console.log(FOUND)
expected result
[ { name:"user 1", bookingid:10, product: "ab" },
{ name:"user 1", bookingid:10, product: "cd" },
{ name:"user 1", bookingid:10, product: "ef" },
{ name:"user 2", bookingid:11, product: "ui" }]
bookingArrcontain arrays and not objects directly ?