DEV Community

Discussion on: Improve your JS skills with those tips #2

Collapse
leob profile image
leob

Yeah but the point of the original author was that "delete" is slow, and therefore you need to use the approach that he proposed ... to which I replied "what if you don't use delete but splice", probably the argument about performance goes away then.

The FP (functional programming/immutable) approach is cool, but there's still a legit case to be made for the old fashioned way - it's only "dangerous" if you do it wrong, heaps of code are written this way which are perfectly fine.

Thread Thread
silverium profile image
Soldeplata Saketos

I said "dangerous" and not "forbidden for any case". Every rule has some exceptions. It's always dangerous to modify arrays in place, that's why it needs double attention, very nice test coverage, and a lot of edge cases coverage, and a good programming team behind.

In this article there is a kind of "show off some syntax hacks", which IMHO opinion, some are hard to read, some are dangerous, especially for immature programmers, and some are "please read Ecma Script latest changes and don't be so cocky" :D

Thread Thread
leob profile image
leob

Haha agreed, especially the second paragraph ;)

The techniques in this article are okay-ish, but I'm not blown away if I may put it like that.