JS array with objects inside code example
Example 1: arrays inside array of objects
var response = {data: [{users: [1,2,3]}, {users: [4,5,6]}]}
var users = response.data.map(o => o.users)
const usersCollection = [].concat(...users)
console.log(usersCollection)
Example 2: how to declare objects inside arrays in javascript
let cats = {
name: 'bob',
children: [let child1 = {
console.log('this is how to create objects inside an array'];
}]
};