上QQ阅读APP看书,第一时间看更新
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.