I'm trying to retrieve the array that has value within another array using filter method. So for instance, from this
[[], [{name:"shop", price: 48}],[]]
to this
[{name:"shop", price: 48}]
From console.log below I get {name:"shop", price: 48}, but when I return v, I get whole thing back--> [[], [{name:"shop", price: 48}],[]]
What am I missing?
const a = [[], [{name:"shop", price: 48}],[]]
const output = a.map((value) => {
return value.filter((v) =>{
console.log(v)
return v
})
})
console.log(output);