Converts Object to Map and Map to Object

PHOTO EMBED

Tue Nov 24 2020 12:48:26 GMT+0000 (UTC)

Saved by @Jota #javascript #object #map

const myObject= {
  'Age': '25',
  'Gender': 'Male',
  'Nationality': 'Australian'
};

const myMap = new Map(Object.entries(myObject)); //object to map
const anotherObject = Object.fromEntries(myMap) // map to object
content_copyCOPY

https://medium.com/javascript-in-plain-english/stop-using-objects-and-arrays-to-store-data-289c3edaaa33