官术网_书友最值得收藏!

Removing values from maps

Maps have a remove() method that works the same way as the list version. The only difference is that it takes a key as the argument instead of an index:

const myMap = Map.of(
'one', 1,
'two', 2,
'three', 3
);
const myChangedMap = myMap.remove('one');

console.log('myMap', myMap.toJS());
// -> myMap { one: 1, two: 2, three: 3 }
console.log('myChangedMap', myChangedMap.toJS());
// -> myChangedMap { three: 3, two: 2 }

By calling remove('one') on myMap, you get myChangedMap, a new map without the removed key.

主站蜘蛛池模板: 元阳县| 花垣县| 镇远县| 青铜峡市| 苍南县| 临湘市| 孝义市| 霍州市| 隆子县| 乌拉特前旗| 大厂| 呼玛县| 永安市| 河池市| 台湾省| 河津市| 会泽县| 陵水| 长海县| 嘉荫县| 浮山县| 离岛区| 紫阳县| 尼玛县| 那坡县| 调兵山市| 彩票| 康定县| 邓州市| 绥棱县| 华池县| 屯门区| 余干县| 托里县| 长乐市| 云浮市| 出国| 武夷山市| 四子王旗| 甘洛县| 兰州市|