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

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.

主站蜘蛛池模板: 姚安县| 蒙自县| 务川| 台东市| 郸城县| 重庆市| 日喀则市| 沧源| 巨野县| 乐清市| 花莲市| 通许县| 泰顺县| 防城港市| 日照市| 兰西县| 曲松县| 巢湖市| 安多县| 金华市| 江安县| 尉氏县| 石泉县| 深水埗区| 安龙县| 图木舒克市| 门头沟区| 双流县| 麻阳| 平和县| 泾源县| 高州市| 沾益县| 景谷| 吴桥县| 大连市| 达州市| 澄城县| 平度市| 桓台县| 鹤岗市|