A Explain What Is Meant By The Functional Programming Term Higher Order Function 3 Marks 4 Marks B Compare Javasc 1 (51 KiB) Viewed 39 times
a) Explain what is meant by the functional programming term higher-order function. (3 marks) (4 marks) b) Compare JavaScript objects to C++ objects. c) Given the code in Listing 1, provide some JavaScript code to produce an array containing only cross-year students (students whose year of study is third year but who are doing fourth-year courses) doing ELEN4010 as an elective. You must make use of arrow functions and Array's filter method. Your solution must not contain any for or while loops. (5 marks) d) Now, provide a function which can be used in conjunction with Array's filter method to allow the user to filter students by any given year of study and elective. Use this function to identify all fourth year students doing ELEN4017. (3 marks)
1 const electiveOne ( courseCode: "ELEN4010", yearoffered: 4 const elective Two = { courseCode: 'ELEN4001", yearoffered: 4 } const electiveThree = { courseCode: 'ELEN4020", yearoffered: 4 } } const electiveFour ( courseCode: 'ELEN4017', yearoffered: 4 let students [ ( }, { }. ( }. ( } name: "Kwezi", student Number: 453528, yearofstudy: 4, electives: [electiveOne, electiveTwo, electiveFour) name: 'Pieter", student Number: 454345, yearOfStudy: 3, electives: [electiveOne) name: 'Jade", studentNumber: 678345, yearOfStudy: 4, electives: [elective Two, electiveThree, electiveFour] name: 'Kiren", student Number: 567893, yearOfStudy: 4, electives: [electiveOne, electiveTwo, elective Three] Listing 1: Students and their electives
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!