DEV Community

sambencivengo
sambencivengo

Posted on

Finally getting the hang of some of these methods

Working through some labs in my Flatiron cohort and some of these methods are starting to feel a bit more second nature:

function findMatching(drivers, str) {
  const result = drivers.filter((driverName) => driverName.toLowerCase() === str.toLowerCase());
  return result;
}
function fuzzyMatch(drivers, str) {
  const result = drivers.filter(driverName => driverName.startsWith(str));
  return result;
}

function matchName(drivers, str){
  const result = drivers.filter(driverName => driverName["name"] === str)
  return result;
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)