Adding `last` to `Array.prototype` is no different than adding `endsWith` to `String.prototype`. ES2015 did it.
It won't break most existing code that defines `Array.prototype.last`. Such code will just overwrite the new `last` method and will continue to work as before. You won't be able to mix old libraries that have their own `last` method with new code if the methods behave differently but that's a different story; that's not breaking existing web pages. What will break though is existing code that test the existence of `Array.prototype.last`; but `String.prototype.endsWith` had the same issue. last(1) would return last but one, and last() would be the same as last(0)
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

