The pullAt()
function from lodash is used to remove elements from an array and return them in a new array. It takes an array of indices at which to remove the elements.
Here is an example:
index.tsx265 chars9 lines
In this example, the pullAt()
function is used to remove the elements at indices 1
and 3
from the myArray
array. The removed elements are returned in the removedElements
array. The original myArray
array is modified to contain only the elements that were not removed.
gistlibby LogSnag