I read Inheritance and the prototype chain on the Mozilla Developer Network and wondered about something he said.
One commonly used feature is the extension of Object.prototype or one of the other built-in prototypes.
I understand why adding a new function to a prototype of my own object can cause problems.
Array.prototype.first = function() { return this[0]; };
But suppose someone created a new array and wanted it to have all the functionality Arraythrough a prototype chain, and they did something like this:
function MyArray() { Array.apply(this, arguments); }
MyArray.prototype = Object.create(Array.prototype);
MyArray.prototype.first = function() { return this[0]; };
Is this method of expanding (inheriting) a native object also considered bad practice? If so, what problems may arise?