Exam Search
JavaScript
20 pts
Exam Search
The pass mark is 50. Write three arrow functions that take an array of scores:
firstPass(scores)returns the first score of 50 or more (usefind), orundefined.firstPassIndex(scores)returns its index (usefindIndex), or-1.lastFail(scores)returns the last score below 50 (usefindLast), orundefined.
The starter prints:
First pass: 72 At index: 2 Last fail: 41 Nobody passed: undefined
Checklist
- Write
firstPasswithfind. - Write
firstPassIndexwithfindIndex. - Write
lastFailwithfindLast. - Use the three search methods.
- The four lines are printed.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
