This brings me to another important conclusion: an array of objects is to be used when I'm collecting a group of "things" that have a number of unique characteristics. Perhaps a different way to describe this is to say that an array of objects is to be used when I'm representing a group of "things" that are unique enough to merit the use of an object for each array item, instead of using a primitive data structure, such as a string.
A perfect example of using an array of objects is to, for example, group an array of users in an app.
Here's such a group of users, represented as an array of JavaScript objects:
xxxxxxxxxx
const users = [
{ name: "Anna", email: "ana@ana.com", country: "United States" },
{ name: "Suzan", email: "suzan@suzan.com", country: "United Kingdom" },
{ name: "Barbara", email: "barb@barbara.com", country: "United States" },
];
console.log(users);
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment