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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.140.198.173