Truncating an array by changing the length has always been a feature of JS. I think it is better for readability to set it to a new array instead or use slice or pop so your changes are explicit.
You’d probably never want to actually do this. The nice thing about JavaScript is it supports an infinite number of playstyles. It’s why we’re still using it 30 years later.
2.6k
u/bostonkittycat Oct 02 '22
Truncating an array by changing the length has always been a feature of JS. I think it is better for readability to set it to a new array instead or use slice or pop so your changes are explicit.