Мне нужно динамически извлекать свойства и функции класса ES6. Возможно ли это?
Используя цикл for for... in, я получаю только сквозные свойства экземпляра класса:
class Foo {
constructor() {
this.bar = "hi";
}
someFunc() {
console.log(this.bar);
}
}
var foo = new Foo();
for (var idx in foo) {
console.log(idx);
}
Вывод:
bar