📅  最后修改于: 2022-03-11 15:02:58.693000             🧑  作者: Mango
// Act on a single key/value in a Mapâconst avengersMap = Immutable.Map({ ironMan: 'Tony Stark', captainAmerica: 'Steve Rogers', blackWidow: 'Natasha Romanov'});âconst updatedAvengers = avengersMap.update('ironMan', (ironManValue) => { // ironManValue is a JavaScript type - no need for Immutable // functions to modify it return ironManValue + ' is ironMan';});â// Output:updatedAvengers Object { "blackWidow": "Natasha Romanov", "captainAmerica": "Steve Rogers", "ironMan": "Tony Stark is ironMan",}