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