如何遍历类属性列表并获取每个属性的值(仅属性而不是函数)
class Person{
name:string;
age:number;
address:Address;
getObjectProperties(){
let json = {};
// I need to get the name, age and address in this JSON and return it
// how to do this dynamically, rather than getting one by one
// like json["name"] = this.name;
return json;
}
}
请帮忙。