Timeline for How do I empty an array in JavaScript?
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Dec 16, 2021 at 14:54 | comment | added | Sebastian Simon |
Then this can be shortened to const originalLength = array.length; array.length = 0; array.length = originalLength; .
|
|
Aug 23, 2019 at 4:59 | comment | added | Cauterite | Though internally there is a difference between undefined elements and empty slots ("holes") | |
Mar 25, 2017 at 18:54 | comment | added | Ruben | It could be a good answer to a different question: "How to convert all elements in an array to undefined elements". | |
Mar 3, 2017 at 8:02 | history | answered | Cauterite | CC BY-SA 3.0 |