City & State Live Search 🔍

This project was built by following Wes Bos's JavaScript 30 course. It allows users to search US cities and states dynamically, highlighting matched text and displaying formatted population numbers.

City & State Live Search screenshot

Code Sample

function findMatches(wordToMatch, cities) {
  return cities.filter(place => {
    const regex = new RegExp(wordToMatch, 'gi');
    return place.city.match(regex) || place.state.match(regex);
  });
}

What I Learned

🔗 View project Live Demo
← Back to projects