const sumValues = (obj) => {
let sum = 0;
const entries = Object.entries(obj); // [[key1, value1], [key2, value2]]
for (const [key, value] of entries) {
sum += typeof value === 'object' ? sumValues(value) : value;
}
return sum;
};
const checkIntoHotel = (hotel, people) => {
let index = 0;
const checkedHotel = hotel.map(({ room }) => room.map(({ id, name }) => {
const {id: parId, name: parName } = people[index];
index += 1;
return { id: parId, name: parName };
}))
return checkedHotel;
};
import { msg } from '<file-name>
export default
. Тогда можно будет обращаться так:import msg from '<file-name>'