Having this example:
class A {
fooA() {
console.log("fooA");
}
printFooBFromA() {
const b = new this.B();
b.fooB();
}
}
class B {
fooB() {
console.log("fooB");
}
}
A.prototype.B = B;
const a = new A();
a.printFooBFromA();
What is the use case of such scenario? Why would one want to insert another class retrospectively?