I want to generate a random object which contains a specific id. For example I want to return objects which contains id 3, the first and third one in the example below:
results = [
{title: "A", ids: [2,3,4,]},
{title: "B", ids: [9,4,7]},
{title: "C", ids: [1,3,4]}
]
let data = results[Math.floor(Math.random() * results.length)]
return data
This is what I tried:
data.map(function (genre){
let random = genre === 3;
return random;
})