re: What should I add to JavaScript Array++? VIEW POST


I think you shouldn't.
I mean, what if someone uses your lib on theirs site and some time later some Array.prototype.move native implementation comes into the ecma standard? This can cause 1) confusion for the developers of that site 2) other libs to break for relaying on the standard version, but it got overridden.
This is the problem within prototype.js and why that lib got a massive lost of adoption.

Overriding native prototypes should be done over extremely controlled environments, when no other alternative is available, and you're not suppose to implement libs that does so.

That aside, overriding prototypes can be a great tool to learn prototype chain and to understand how native methods works.

Those functions could be exported expecting a extra parameter that is the array it will act upon.


Ok, and I understand what you're saying, but these are meant to be temporary, until like you said, they become native to JS.

code of conduct - report abuse