The array to clear.
A new array containing the elements that were removed.
const array = [1, 2, 3, 4, 5]
const removed = clearArray(array)
console.log(array, removed) // [] , [1, 2, 3, 4, 5]
If there are no elements to remove, an empty array is returned.
const array = []
const removed = clearArray(array)
console.log(array, removed) // [] , []
console.log(array === removed) // false
Generated using TypeDoc
Removes all elements from an array by mutating it in-place.