- 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.
推薦閱讀
- Oracle從新手到高手
- OpenCV實例精解
- 算法零基礎(chǔ)一本通(Python版)
- JavaScript+jQuery網(wǎng)頁特效設(shè)計任務(wù)驅(qū)動教程(第2版)
- JavaScript語言精髓與編程實踐(第3版)
- Vue.js前端開發(fā)基礎(chǔ)與項目實戰(zhàn)
- PyTorch自然語言處理入門與實戰(zhàn)
- Mastering LibGDX Game Development
- Visual Basic程序設(shè)計與應(yīng)用實踐教程
- Modern JavaScript Applications
- Android底層接口與驅(qū)動開發(fā)技術(shù)詳解
- ASP.NET程序開發(fā)范例寶典
- Nagios Core Administration Cookbook(Second Edition)
- Exploring SE for Android
- Getting Started with Electronic Projects