This is driving me crazy.
I'm trying to do a get an array that is the difference between two arrays containing json objects.
I can do this easily with arrays of primitive values, by using sets. I mainly come from a Java background not JavaScript and this seems annoyingly difficult.
const available = [{time:1, chargable: true}, {time:2, chargable: false}, {time:3, chargable: true},{time:4, chargable: true}];
const booked = [{time:2, chargable: false}, {time:3, chargable: false}, {time:4, chargable: false}];
const remainingAvailable = findRemainingAvailable(available, booked)
I want remainingAvailable
to contain: [{time:1, chargable: true}]
How do I do that (ideally using funky functions like filter etc)?
Please login or Register to submit your answer