📅  最后修改于: 2022-03-11 14:47:59.799000             🧑  作者: Mango
const rooms = {r1: "Room 1", r2: "Room 2", r3: "Room 3"};
const arrayResult = Object.keys(rooms).map(room => {
return {id: room, name: rooms[room]}
});