- 遍历对象并取值
let keys = Object.keys(profession);
let arr = [];
for (let i = 0; i < keys.length; i++) {
let obj = {
id: keys[i],
name: profession[keys[i]].title
};
arr.push(obj)
}
let keys = Object.keys(profession);
let arr = [];
for (let i = 0; i < keys.length; i++) {
let obj = {
id: keys[i],
name: profession[keys[i]].title
};
arr.push(obj)
}
本文标题:JS
本文链接:https://www.haomeiwen.com/subject/fahoqctx.html
网友评论