News for hackers. Stuff that matters.
Re:Writing a tiny undo/redo stack in JavaScript by jansan on Thursday March 27, 2025 @02:34AM (#43490919)
foo.splice(0) is actually sufficient. From the docs:

"If deleteCount is omitted, or if its value is greater than or equal to the number of elements after the position specified by start, then all the elements from start to the end of the array will be deleted."

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...

There are no comments on this comment yet.