- 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.
推薦閱讀
- 新編Visual Basic程序設(shè)計(jì)上機(jī)實(shí)驗(yàn)教程
- 數(shù)據(jù)庫(kù)系統(tǒng)教程(第2版)
- 復(fù)雜軟件設(shè)計(jì)之道:領(lǐng)域驅(qū)動(dòng)設(shè)計(jì)全面解析與實(shí)戰(zhàn)
- CockroachDB權(quán)威指南
- Dynamics 365 Application Development
- Developing Mobile Web ArcGIS Applications
- Xcode 7 Essentials(Second Edition)
- PostgreSQL技術(shù)內(nèi)幕:事務(wù)處理深度探索
- Spring Cloud、Nginx高并發(fā)核心編程
- Expert Android Programming
- HTML 5與CSS 3權(quán)威指南(第3版·上冊(cè))
- 機(jī)器學(xué)習(xí)微積分一本通(Python版)
- Mastering Concurrency in Python
- 從零開(kāi)始學(xué)Selenium自動(dòng)化測(cè)試:基于Python:視頻教學(xué)版
- Developing Java Applications with Spring and Spring Boot