Can the set method of map in ES6 determine whether a key exists or not and then treat it differently?

requirement is how to determine that the key already exists and then deal with it differently when adding a key value to the map?

let msg = new Map()
msg.set("a",{count: 10})
msg.set("a",{count: 20})

 a count,a,

how should this be achieved?

Es6
Dec.30,2021

opening the console and swinging the keyboard is a new Map ()
clipboard.png
MDN:

clipboard.png

?:

let msg = new Map()
msg.set('a',{count: 10})
if(msg.has('a')){
    let data=msg.get('a')
    data.count+=10
    msg.set('a',data)
}else{
        msg.set('a',{count:10})

}

borrow the method upstairs,

let msg = new Map()
msg.set('a',{count: 10});
if(msg.has('a')) {
    var val = msg.get('a').count;
    val += val;
    msg.set('a',{count: val} )
}else {
    mgs.set('a', {count: 10})
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b39876-e6ee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b39876-e6ee.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?