I am trying to write a function that prints out a list of all courses with a passing grade but cant’t figure out how. How may I implement that? (The minimum passing grade is 5.)
input:
courses = [Math, Geography, Chemistry]
grades = [7, 3, 5]
(the grades[0] grade corresponds to the courses[0] course and so on.)
I have tried using a filter but it didn’t work (though I was using it wrong since the filter parameter is not an index.)
It was something like courses.filter((x) => grades[x] >=5)