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

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.

主站蜘蛛池模板: 太康县| 成安县| 南木林县| 广州市| 黄大仙区| 垣曲县| 庄河市| 宁城县| 彩票| 千阳县| 高陵县| 招远市| 三河市| 师宗县| 泸溪县| 晋江市| 确山县| 宝坻区| 威信县| 栖霞市| 元阳县| 青浦区| 日喀则市| 福安市| 昭苏县| 嵊州市| 仲巴县| 汶上县| 顺义区| 阳西县| 萨嘎县| 盖州市| 佛山市| 马尔康县| 阜康市| 大兴区| 班玛县| 四子王旗| 南丹县| 武强县| 兴隆县|