In this lab, we'll use the filter
method to write functions that properly query our data.
This lab contains an array of drivers with various information. We need to write methods using the filter
method so that Scuber employees can easily query the data. Be sure to run the tests to get a feel for the types of problems this lab is asking you to solve.
You'll be writing three functions:
findMatching
- This function takes an array ofdrivers
and astring
as arguments, and returns the matching list of drivers. The function should be case insensitive.fuzzyMatch
- This function takes an array ofdrivers
and astring
as arguments for querying the array, and returns all drivers whose names begin with the provided letters.matchName
- This function takes an array ofdrivers
and astring
as arguments. In this function, each element of thedrivers
array is a JavaScript object that has a property ofname
. The function should return each element whosename
property matches the providedstring
argument.
View Filter Lab on Learn.co and start learning to code for free.