JavaScript has only one data type which can contain multiple values: Object. An Array is a special form of an object.

When we work with Javascript objects it is almost certain that we will find ourselves in a situation like this.

let user = {
    id: 42,
    address: [{
            street: "Av Brasil, 200",
            city: 'São Paulo',
            country: "Brazil",
            mainAddress: true
            street: "Av Atlantica, 150",
            city: 'Rio de Janeiro’,
            country: "Brazil",
            mainAddress: false

This example is quite common, and happens on several different occasions.
In the example, we have a user, he has registered the addresses. One address is the main one, which we can imagine to be the home address, and a second alternative address which we can consider the address of a relative.


How to work with Javascript objects - Debug Everything
1.60 GEEK