我有一个类,另一个类扩展了该类.
class Shape {
constructor() {
return this;
}
}
class Circle extends Shape {
constructor() {
super();
return this;
}
}
let foo = new Circle();
Run Code Online (Sandbox Code Playgroud)
我可以和foo一起上课
let className = foo.constructor.name
// returns string 'Circle'
Run Code Online (Sandbox Code Playgroud)
是否有可能以类似的方式获得foo的超类('Shape')的名称?