While reviewing someone else's code, I came across the following snippet:
class foo extends bar {
constructor() {
super(param1, param2, new certainObject(this, otherParams));
}
}
The issue with this code is that it generates an error stating that
'super' must be called before accessing 'this' in the constructor of a derived class
.
I am wondering if there is a way to incorporate the use of this
within the call to super()
, or if I will need to completely modify the code structure?