A few months ago, I saw someone one Twitter ask:
Can we create an object by looping on some data 🤔
Today, I wanted to write about how to do just that. Let’s dig in!
An example of some data Let’s imagine you got back an array of data from an API service called WizardSchool. It provided you with a list of wizards.
Each wizard in the array is itself an object that contains the wizard’s name, and an array of spells that they know how to cast.