Skip to content
Advertisement

create new array from nested array object

i want to create a new array from api, but i don’t know how to make it, i’m very confused in looping each array

This is each data

JavaScript

this is the main data of api

JavaScript

i want to create a new array like this, bcs i want to create a new object containing the group_id of each same data in the array

JavaScript

can someone help me? with articles or codes. thanks for helping me (sry for my bad english)

Advertisement

Answer

Please see below commented code:

JavaScript
Advertisement