- Mastering Immutable.js
- Adam Boduch
- 88字
- 2021-07-08 10:30:12
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.
推薦閱讀
- 案例式C語言程序設計
- Learning Apex Programming
- Python金融數據分析
- SQL經典實例(第2版)
- RISC-V體系結構編程與實踐(第2版)
- CoffeeScript Application Development Cookbook
- 一本書講透Java線程:原理與實踐
- 快速入門與進階:Creo 4·0全實例精講
- 石墨烯改性塑料
- 深度學習入門:基于Python的理論與實現
- Microsoft Dynamics GP 2013 Cookbook
- Kudu:構建高性能實時數據分析存儲系統
- Building RESTful Web Services with PHP 7
- Django 3 Web應用開發從零開始學(視頻教學版)
- Python快速編程入門