const schoolArr = {
class10: {
studentInfo: {name: 'John'},
exam: {result: 'pass'}
},
class11: {
studentInfo: {name: 'Alis'},
exam: {result: 'pass'}
},
class12: {
studentInfo: {name: 'Nick'},
exam: {result: 'fail'}
}
};
Looking for a solution to generate a list of student names if the exam result is 'pass'. The classes (class10, class11, class12) are dynamically changing and I'm struggling with how to iterate through these dynamic values.
The desired output should be an array like this: student = ['John', 'Alis']