I have the following use-case,
I have,
- An array of objects that contains a list of
courses - An array of objects that contains
studentswith a nestedarray: studies
I need to find a courses which are not studied by any student.
How to achieve that?
follow is the code sinnpient.
let courses = [
{ id: 'A' },
{ id: 'B' },
{ id: 'C' },
{ id: 'D' }, <-- not studied by any one
{ id: 'E' },
{ id: 'F' }, <-- not studied by any one
];
let students = [
{
name: 'STD1',
study: [
{ id: 'A' },
{ id: 'C' }
]
},
{
name: 'STD2',
study: [
{ id: 'B' },
{ id: 'E' }
]
}
];
expected output
const notUsedCourse = [{ id: 'D' }, { id: 'F' }];
.filter(),.some(), things like that). Then, if you are really stuck, we can help you. But Stackoverflow is not a free code writing platform. We can help you but not develop the whole solution for you.