Skip to content

Add Matching Functions#10

Open
yuriyivanenko wants to merge 3 commits intolearn-co-curriculum:masterfrom
yuriyivanenko:test_branch
Open

Add Matching Functions#10
yuriyivanenko wants to merge 3 commits intolearn-co-curriculum:masterfrom
yuriyivanenko:test_branch

Conversation

@yuriyivanenko
Copy link

Created functions to match in various ways including, matching in array and array of objects. Also utilizes some mild fuzzy word search.

@yuriyivanenko
Copy link
Author

I used the return keyword in all functions because putting everything on one line seemed like too much.

Copy link

@stephenmckeon stephenmckeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job!

Comment on lines +5 to +7
const fuzzyMatch = (drivers, name) => {
return drivers.filter(driver => driver.substring(0,1) === name.substring(0,1));
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this works, and passes the test, but not for all examples (if the name provided was "Ste", this would provide a false positive for "Stove" since it's only looking at the first letter of either). Take a peak at the startsWith function. You don't need to make changes, but if you have extra time, play around with it. Thanks!

Suggested change
const fuzzyMatch = (drivers, name) => {
return drivers.filter(driver => driver.substring(0,1) === name.substring(0,1));
}
const fuzzyMatch = (drivers, name) => {
return drivers.filter(driver => driver.substring(0,1) === name.substring(0,1));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants