export function getPlanetNames(data) {
const pNames = data.planets;
const results = pNames.filter(function (getNames) {
return getNames.name;
});
return results;
'data' is stored in a separate file and consists of an object array with various attributes.
For example, data = { planets: [{blah blah blah}] asteroid: [{blah blah blah blah}]}
I'm facing an issue with my code above where it's not retrieving the names from the planets array, which is an attribute of the planets array.