5 ms·
If I remember correctly, the array methods `.includes`, `.every`, and `.some` were renamed because of collision with prototype.js's `.contains`, `.all`, and `.a
by runarberg 9y ago
If I remember correctly, the array methods `.includes`, `.every`, and `.some` were renamed because of collision with prototype.js's `.contains`, `.all`, and `.any` respectively.
- haukur 9y agoIt's very unfortunate that the APIs of libraries that extend JavaScript builtins affect the development of the language to this degree.
- eximius 9y agoThat is the stupidest thing I've ever heard. Why would that matter? That would encourage me the naming choice was in the right direction!
- thaiphanvevo 9y agoLots of websites still use Prototype.js. Magento still has it as a dependency. Don't want to break the web!
- eximius 9y agoWould it break the web though? Wouldn't they just override the native implementation with a JS one?
- curtisblaine 9y agoThen the two implementations would probably be incompatible (different signatures, different implementation / return values) and would cause unexpected errors down the chain. So, essentially, breaking the web and making it difficult to fix it.
- curtisblaine 9y agoWould it be bad though? A lot of APIs change in the browser space. WebRTC was broken a hundred times. Libraries depending on Prototype would probably be old, maybe insecure. You need to break it from time to time, you can't be backwards compatible all the time.