DEV Community

Cover image for 🧠 Access and process nested objects, arrays & JSON
Ali Boukaroui
Ali Boukaroui

Posted on

🧠 Access and process nested objects, arrays & JSON

For more useful content, please follow me on @aliboukaroui

With the onset of ES2015 there are alternatives to get a hold of the data you require. There is now a feature called object destructuring for accessing nested objects.

The above example creates a variable called secondName from the name key from an array called items, the lonely , says skip the first object in the array.

Notably it's probably overkill for this example, as simple array acccess is easier to read, but it comes in useful when breaking apart objects in general.

Top comments (0)