Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 53 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1,53 @@
// Code your solution here
// added for logging purposes
const drivers = [
{
name: "Bobby",
hometown: "Pittsburgh",
},
{
name: "Sammy",
hometown: "New York",
},
{
name: "Sally",
hometown: "Cleveland",
},
{
name: "Annette",
hometown: "Los Angeles",
},
{
name: "Bobby",
hometown: "Tampa Bay",
},
];


const findMatching = (collection, name) =>
collection.filter((driver) => driver.toLowerCase() === name.toLowerCase());


const fuzzyMatch = (collection, name) =>
collection.filter((driver) => driver.startsWith(name));


const matchName = (collection, name) =>
collection.filter((driver) => driver.name === name);

// function findMatching(collection, name) {
// return collection.filter(function (driver) {
// return driver.toLowerCase() === name.toLowerCase();
// });
// }

// function fuzzyMatch(collection, name) {
// return collection.filter(function (driver) {
// return driver.startsWith(name)
// })
// }

// function matchName(collection, name) {
// return collection.filter(function (driver) {
// return driver.name === name
// })
// }