Every pages property has a first property with a random name. How can I access this property?
I thought about pages[0] but it's not an array.
I'm dealing with an API.
CodePudding user response:
Use Object.values()
to convert the object to an array, then get the first value.
Object.values(pages)[0]
CodePudding user response:
As long as there is only one nested object, you can use this to get the driver object.
pages[Object.keys(pages)[0]]