News for hackers. Stuff that matters.
Re:Stage 3 Proposal: Array.prototype.at by inbx0 on Wednesday June 02, 2021 @02:00PM (#27371911)
That will break with

> Uncaught TypeError: Cannot convert undefined or null to object

because `myObjectArr.at` doesn't bind `this` to `myObjectArr`. When the internals of `map` call the `at` function, `this` is just `undefined` instead of the original array and it'll throw.

Luckily Array.prototype.map takes a second argument just for this purpose

    indices.map(myObjectArr.at, myObjectArr)
Re:Stage 3 Proposal: Array.prototype.at by antris on Wednesday June 02, 2021 @02:38PM (#27372329)
Oh wow, I had to try it to make sure. I can't believe how broken the fundamentals of JS are.

There should really be a whole new standard library made from ground up without `this`, mutability and all the other legacy stuff.