In one of my class static methods I have to create a new instance of the same class.
class User { static find() { const newUser = new this(); // new static(); in PHP }}
The example above works but I got linting error:
“new” operators should be used with functions
Now, I’m wondering what’s the correct way to do it?
Tried new this.constructor() but it’s returning a function not an object.
#php #node-js