I am facing an issue with removing objects from an array that do not contain the data object. I have attempted to use the filter method but have not been successful.
results.filter(obj => obj.data === undefined)
results = [
{id: 1,
location: 'a',
data: {
latlong: 456464,456465,
value: 45},
team: a},
{id: 2,
location: 'f',
data: {
latlong: 12323,456465,
value: 43},
team: c},
{id: 3,
location: 'a',
team: a},
{id: 4,
location: 'g',
team: f}
]
This is how I would like the results to appear:
results = [
{id: 1,
location: 'a',
data: {
latlong: 456464,456465,
value: 45},
team: a},
{id: 2,
location: 'f',
data: {
latlong: 12323,456465,
value: 43},
team: c}
]