Skip to content

Instantly share code, notes, and snippets.

@ConnectedReasoning
Last active August 7, 2019 11:35
Show Gist options
  • Save ConnectedReasoning/ac360d1617e2ddca9239daa5a316806e to your computer and use it in GitHub Desktop.
Save ConnectedReasoning/ac360d1617e2ddca9239daa5a316806e to your computer and use it in GitHub Desktop.
converts an array of items into an object containing name-value pairs with null as the value
myObjectOfItems = myArray.reduce((obj, item) => {
obj[item['propertyToIsolate']] = null
return obj
}, {});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment