How to get subclasses in JavaScript?

for example, how do you get all the subclasses of a specified base class using a class defined by es6 class?

for example, three classes A, B, C

are defined below.
class A {}
class B extends A{}
class C extends A{}

how do we get all the subclasses of A? (= ^--^ =)

< hr >

some people say that this question is meaningless. Haven"t you ever experienced the situation of switching multiple operations according to the state? Is it more elegant to use if-else judgment one by one than to use class to implement polymorphism? Please tell me

May.05,2022

  https://blog.rxliuli.com/p/e1...

					
Menu