- 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.
推薦閱讀
- Mastering Entity Framework
- Mastering Python Scripting for System Administrators
- Unity Virtual Reality Projects
- 網(wǎng)店設計看這本就夠了
- Python機器學習編程與實戰(zhàn)
- Canvas Cookbook
- 深入分析GCC
- H5+移動營銷設計寶典
- Data Manipulation with R(Second Edition)
- Web前端測試與集成:Jasmine/Selenium/Protractor/Jenkins的最佳實踐
- VMware vSphere Design Essentials
- 鋁合金陽極氧化與表面處理技術(第三版)
- 現(xiàn)代JavaScript編程:經(jīng)典范例與實踐技巧
- Python GUI設計tkinter菜鳥編程(增強版)
- Serverless從入門到進階:架構、原理與實踐