how to make new array of the date and time which not picked on the date which available for this case ?
and the case is something like this
const theNumOne = [
{
date: "monday",
time: ["06.00", "07.00", "08.00", "09.00", "10.00"]
},
{
date: "tuesday",
time: ["06.00", "07.00", "08.00", "09.00", "10.00"]
},
{
date: "wednesday",
time: ["06.00", "07.00", "08.00", "09.00", "10.00"]
}
]
const pickOne = [
{
date: "monday",
time: ["09.00", "10.00"]
},
{
date: "wednesday",
time: ["06.00", "07.00", "08.00"]
}
]
the result would be like this
[
{
date: "monday",
time: ["06.00", "07.00", "08.00",]
},
{
date: "tuesday",
time: ["06.00", "07.00", "08.00", "09.00", "10.00"]
}
{
date: "wednesday",
time: ["09.00", "10.00"]
}
]
the result is the time which not includes on theNumOne in pickOne, like say i pick monday on 09.00 and 10.00 but i did not pic the time from 6- 8 so i want put that 6-8 and the day into that array of object
i have tried this
const result = []
for( let i of theNumOne){
for(let j of i.time){
for(let z of pickOne){
for(let x of z.time){
if(i !== z ){
result.push({
date: i,
time: z
})
}
}
}
}
}