Why do Bootstrap Table extensions use class inheritance instead of modifying the prototype?

I’m currently studying the jQuery bootstrap-table plugin and I’ve noticed something that I don’t fully understand. In the main bootstrap-table.js file, they instantiate a BootstrapTable class and assign it to $.BootstrapTable, which makes sense to me.

However, for extensions, they do the following:

$.BootstrapTable = class extends $.BootstrapTable {
  // extension code
}

This creates a new JavaScript file with the entire BootstrapTable class and the additional extension code. This approach seems to create two large JavaScript files with duplicate definitions of the class.

Wouldn’t it be more efficient to modify the prototype of the class directly to avoid code duplication? For example:

BootstrapTable.prototype.newFunction = function() {
  // new function code
}

Additionally, by storing the old method in a variable and calling it within the new function, we can preserve the extensions that precede us. For example:

const oldExistFunction = $.BootstrapTable.prototype.existFunction;
$.BootstrapTable.prototype.existFunction = function() {
  oldExistFunction.call(this);
  console.log('This is the new existFunction.');
}

By doing this, we wouldn’t have duplicated class definitions. Are there specific reasons for choosing class inheritance over prototype modification in this context? What are the advantages and disadvantages of each approach?

I appreciate any insights or explanations you can provide. Thank you!

What I tried:
I tried modifying the prototype directly and storing the old method in a variable before redefining it. I expected this to avoid code duplication and maintain the previous extensions’ functionality.

What I expected:
I expected that modifying the prototype directly would be a more efficient way to add new functionality without duplicating the entire class definition.

What actually happened:
While modifying the prototype worked as expected in my tests, I’m wondering if there are specific reasons why the bootstrap-table plugin developers chose to use class inheritance instead. Are there particular advantages or use cases that make inheritance a better choice in this context?