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
50 changes: 49 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1 +1,49 @@
// Code your solution here
function findMatching(arrayDriver, driver) {
return arrayDriver.filter((possibleDriver) => isMatching(possibleDriver, driver))
}

function isMatching(possibleDriver, driver) {
return possibleDriver.toLowerCase() === driver.toLowerCase();
}

function fuzzyMatch(arrayDriver, startingLetters) {
return arrayDriver.filter((possibleDriver) => {
return possibleDriver.startsWith(startingLetters);
})
}

function matchName(arrayDriver, soughtName) {
console.log("test")
return arrayDriver.filter((possibleDriver) => {
return possibleDriver.name === soughtName
console.log(matchName(arrayDriver, soughtName))
})
}
Comment on lines +15 to +21

Choose a reason for hiding this comment

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

Suggested change
function matchName(arrayDriver, soughtName) {
console.log("test")
return arrayDriver.filter((possibleDriver) => {
return possibleDriver.name === soughtName
console.log(matchName(arrayDriver, soughtName))
})
}
function matchName(arrayDriver, soughtName) {
return arrayDriver.filter((possibleDriver) => {
return possibleDriver.name === soughtName
})
}


// goes into arrayDriver and pulls name value that matches soughtname

// to get name key use dot notation on object
// pull from array object that match sought name
// source = driver object

const soughtName = "Annette"
const arrayDriver = [
{
name: 'Bobby',
hometown: 'Pittsburgh' },
{
name: 'Sammy',
hometown: 'New York' } ,
{
name: 'Sally',
hometown: 'Cleveland' },
{
name: 'Annette',
hometown: 'Los Angeles' },
{
name: 'Bobby',
hometown: 'Tampa Bay' }
];

matchName(arrayDriver, soughtName)
Comment on lines +23 to +48

Choose a reason for hiding this comment

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

Please clean this up next time:

Suggested change
// goes into arrayDriver and pulls name value that matches soughtname
// to get name key use dot notation on object
// pull from array object that match sought name
// source = driver object
const soughtName = "Annette"
const arrayDriver = [
{
name: 'Bobby',
hometown: 'Pittsburgh' },
{
name: 'Sammy',
hometown: 'New York' } ,
{
name: 'Sally',
hometown: 'Cleveland' },
{
name: 'Annette',
hometown: 'Los Angeles' },
{
name: 'Bobby',
hometown: 'Tampa Bay' }
];
matchName(arrayDriver, soughtName)