Is there anyway to make setter/getter only for class object? What I mean is, is there anyway to set get
/set
for this
in class? For example:
class something {
constructor() {
// ...
}
get this() {
return 'Fizz buzz'
}
}
const somethingelse = new something
console.log(something) // "Fizz buzz"
This is what I want to get. If I want it to work exactly the same, I need to do const {this} = new something
, which is what I don't want to use.