Say I have the following array of unnamed objects each of which is an array of named objects:
[{id: 123, name: 'Foo', code: 'ABC123', enabled: true},{id: 124, name: 'Bar', code: '123ABC', enabled: true}]
This data has been converted into an Array of objects from a API call response, so none of the named objects are defined. For instance I cant check the name
of any object using something like:
for (let i = 0; i < resp.length; i++){
if(resp[i].name = key){do something}
}
(i.e the solution for the following question: Find a value in an array of objects in Javascript) because name
is undefined for the objects in resp.
Is there a way for me to access that attribute on that object?