I would say that this is bad practice in this case, since you have no control over the fact that the added method [id] becomes overridden inside the class.
var test = new Test(); test.extend("example", function() { console.log("First Method"); }); test.extend("example", function() { console.log("Second Method"); });
Like your code, you do not know when the first method will be overridden and thus randomly breaks your code.
source share