📅  最后修改于: 2022-03-11 15:02:10.105000             🧑  作者: Mango
const schedule = {
date: '0305',
meeting1: {
id: '00001',
start: '10:30'
},
meeting2: {
id: '00002',
start: '12:30'
}
};
function getNestedObjValuesByQueue(obj){
let queue = [obj]
let values = []
while (queue.length > 0){
let current = queue.shift();
for (let val of Object.values(current)){
if(typeof val === "object") queue.push(val);
else values.push(val);
}
}
console.log(values)
}
getNestedObjValuesByQueue(schedule)
Run code snippet