News for hackers. Stuff that matters.
Re:What’s New in ES2019 by zachrose on Tuesday July 30, 2019 @06:28AM (#20563512)
In other words you’re concerned that some Array methods mutate the array (push, pop) and some don’t (map, concat)?

If so then yeah, that can be annoying and/or confusing.

Re:What’s New in ES2019 by lkschubert8 on Tuesday July 30, 2019 @06:42AM (#20563572)
For me the worst is slice/splice.
Re:What’s New in ES2019 by Accacin on Tuesday July 30, 2019 @07:11AM (#20563726)
Kind of stupid, but I imagine the 'p' in 'splice' being an axe that chops the array :D Works for me...
Re:What’s New in ES2019 by nkozyra on Tuesday July 30, 2019 @07:42AM (#20563914)
I think OP was saying slice returns a mutated copy while splice mutates in place.
Re:What’s New in ES2019 by afandian on Tuesday July 30, 2019 @06:34AM (#20563532)
Yes, it stems from arrays. But extends from there to any collection, built in or custom. Kind of bridges the built in type system but it's really about the expressivity of the language.

It becomes especially important in React where you share objects up and down an immutable structure of objects.

Re:What’s New in ES2019 by zachrose on Wednesday July 31, 2019 @01:59PM (#20576683)
Yep. If you've bitten the apple of JavaScript tooling you can kinda sorta rig up compiler-enforced immutable data structures with TypeScript. But IMO if you're going that far it's much easier/well-documented to just use Elm or something.