Skip to content
Advertisement

Flatten objects in array

Hey folks I am getting an array of objects from a response. I need to flatten all of the students objects to simply studentName but not certain how. Any help would be greatly appreciated.

Example Array:

JavaScript

What I am trying to do:

JavaScript

Advertisement

Answer

You can create and return a new array of result using map as:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement