Detect direct instances in JavaScript
A couple of years ago, I wanted figure how to create a type check for class A
that returns true
only for objects instantiated by new A()
. For this, I wrote the class like this:
A couple of years ago, I wanted figure how to create a type check for class A
that returns true
only for objects instantiated by new A()
. For this, I wrote the class like this: