Prevent Class Method From Being Overwritten
class A {
method() {
console.log('original')
}
}
Object.freeze(A.prototype)
let a = new A()
a.method = function() { console.log('overwritten') }
a.method()
class B {
method() {
console.log('original')
}
}
let b = new B()
b.method = function() { console.log('overwritten') }
b.method()