Created
April 5, 2024 08:49
-
-
Save Kcko/2b0163546370d771b36586e40117ad21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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