我如何在下面循环这个对象"fields": { "summary": { "required": true }, "issuetype": { "required": true }, "description": { "required": false }}并得到这个结果res = ['summary','issuetype','description']
1 回答
12345678_0001
TA贡献1802条经验 获得超5个赞
只需使用Object.keys
:
const obj = {
"fields": {
"summary": {
"required": true
},
"issuetype": {
"required": true
},
"description": {
"required": false
}
}
};
console.log(Object.keys(obj.fields)); // ["summary", "issuetype", "description"]
添加回答
举报
0/150
提交
取消