Slot pribadi baru dan dapat dibuat melalui metode dan aksesor pribadi
// ES2022
class MyClass {
#privateMethod() {}
static check() {
const inst = new MyClass();
console.log(#privateMethod in inst) // output-> true
console.log(#privateMethod in MyClass.prototype) // output-> false
console.log(#privateMethod in MyClass) // output-> false
}
}
MyClass.check();
Puzzled Puffin