class a {
get b() {
delete this.b;
return this.b = 1;
}
}
var c = {
get b() {
delete this.b;
return this.b = 1;
}
}
console.log(c.b); // works as expected
console.log((new a()).b); // throws error
The above code should work fine but the last line throws.
Uncaught TypeError: Cannot set property b of # which has only a getter(…)
Clearly the getter is not being deleted in class whereas it works fine in object. I am on latest stable chrome.