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