Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

For what it's worth, there are only two, maybe three methods in that entire list that mutate where it's not obvious: sort, reverse, and (maybe) splice. All the other methods (like push, pop, fill, etc) are methods whose entire purpose is to mutate the array.


That was my first impression. But then the same logic applies to concat. ("I want to add another array").


Sometimes I don’t. Actually usually I don’t, I do a lot of [].concat(a, b).




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: