I have rooms list, and it's like this:
const insertedDates = [2023-11-13, 2023-11-14, 2023-11-15];
const roomList = [
{
name: "Room 1",
price: 250,
roomNumbers: [
{
number: 104,
unavailableDates: [2023-11-13, 2023-11-14, 2023-11-15]
}
{
number: 102,
unavailableDates: []
}
]
}
]
Firstly, I want to compare the inserted dates to rooms' unavailable dates. If the first room number's dates matches with them, pass to the next one. Then the room number's dates doesn't match with the inserted dates, it should be pushed in it.
Expected:
const roomList = [
{
name: "Room 1",
price: 250,
roomNumbers: [
{
number: 104,
unavailableDates: [2023-11-13, 2023-11-14, 2023-11-15]
}
{
number: 102,
unavailableDates: [2023-11-13, 2023-11-14, 2023-11-15]
}
]
}
]
Is it possible to do it in JavaScript?
Via Active questions tagged javascript - Stack Overflow https://ift.tt/Ne1lc8z
Comments
Post a Comment