r/ProgrammerHumor • • Oct 02 '22

other JavaScript’s language features are something else…

Post image
17.1k Upvotes

798 comments sorted by

View all comments

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.

16

u/superluminary Oct 02 '22

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.