- Mastering Immutable.js
- Adam Boduch
- 85字
- 2021-07-08 10:30:12
Removing values from lists
If you know the index of the list value that you want to remove, you can pass the index to the remove() method to create a new list without the removed value, as follows:
const myList = List.of(1, 2, 3);
const myChangedList = myList.remove(0);
console.log('myList', myList.toJS());
// -> myList [ 1, 2, 3 ]
console.log('myChangedList', myChangedList.toJS());
// -> myChangedList [ 2, 3 ]
You can see here that myChangedList results from calling remove(0). It's a new list, without the first value.
推薦閱讀
- Spring 5.0 Microservices(Second Edition)
- Building a Game with Unity and Blender
- Learning C++ Functional Programming
- JMeter 性能測試實戰(第2版)
- OpenStack Cloud Computing Cookbook(Fourth Edition)
- Linux命令行與shell腳本編程大全(第4版)
- 劍指Java:核心原理與應用實踐
- Oracle 18c 必須掌握的新特性:管理與實戰
- 小型編譯器設計實踐
- GitHub入門與實踐
- Magento 2 Beginners Guide
- JSP程序設計與案例實戰(慕課版)
- Python網絡爬蟲實例教程(視頻講解版)
- HTML5 Canvas核心技術:圖形、動畫與游戲開發
- 循序漸進Vue.js 3前端開發實戰