O'Reilly logo
  • Bob Massarczyk thinks this is interesting:

If you need to transform an array into an object, you can use Array.map in conjunction with Object.keys. Object.keys is a method that can be used to return an array of keys from an object.

Let’s say we needed to transform schools object into an array of schools:


Cover of Learning React, 1st Edition


Decide what you want to do. Array to object or object to array?