I am working with a JavaScript map that contains multiple values. Here is an example (simplified for clarity):
Map(2) {
'group1' => {
username: 'userTest',
dsId: '710300636817653790',
openDate: '2021-12-13 18:29:16'
},
'group2' => {
username: 'Juojo',
dsId: '477581625841156106',
openDate: '2021-12-13 18:29:23'
}
}
My goal is to retrieve the username value ('Juojo') from the second group of data. I attempted to do this:
console.log(map.get(group2.username));
However, this returns "undefined". When I try without the ".username" (console.log(map.get(group2));
), it gives me:
{
username: 'Juojo',
dsId: '477581625841156106',
openDate: '2021-12-13 18:29:23'
}
I only want the output to be "Juojo"