Skip to content

Instantly share code, notes, and snippets.

@Kcko
Created April 5, 2024 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kcko/2b0163546370d771b36586e40117ad21 to your computer and use it in GitHub Desktop.
Save Kcko/2b0163546370d771b36586e40117ad21 to your computer and use it in GitHub Desktop.
const data = [
{
id: 1,
user: 'Kcko',
gender: 'M'
},
{
id: 2,
user: 'Superman',
gender: 'M'
},
{
id: 3,
user: 'WonderWoman',
gender: 'F'
}
];
const hashData = new Map(data.map(user => [user.user, user]))
hashData.set('Kunda', {
id: 100,
user: 'pan Kunda',
gender: 'NB'
})
console.log(hashData)
console.log(hashData.get('Kcko'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment