How to test if B is a “subclass” of A in Javascript/Node?

To check if B is a subclass of A (excluding the case where B === A):

B.prototype instanceof A

To check if B is a subclass of A (including the case where B === A):

B.prototype instanceof A || B === A

If you have an instance of B, the second test can be simplified to

b instanceof A // where b is an instance of B

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)