const result = hotel.map((h) => {
return {
...h,
room: h.room.map((r) => {
r.id = participants[0].id;
r.name = participants[0].name;
participants.shift();
return r;
}),
};
});'[{"room":[{"id":1,"name":"Anakin Skywalker"}]},{"room":[{"id":2,"name":"Padmé Amidala"},{"id":3,"name":"Luke Skywalker"}]},{"room":[{"id":4,"name":"Princess Leia"}]}]'