Building Blocks of ExpressJS/Level 5/5.6 Using All/apps.js
// Searches for keyword in description and returns the city
Searches for keyword in description and returns the city
Searches for keyword in description and returns the city
function citySearch(keyword) {
  var regexp = RegExp(keyword, 'i');
  var result = cities.filter(function (city) {
    return city.match(regexp);
  });
  return result;
}
function citySearch ( keyword ) { var regexp = RegExp ( keyword , 'i' ) ; var result = cities . filter ( function ( city ) { return city . match ( regexp ) ; } ) ; return result ; }
Searches for keyword in description and returns the city
Searches for keyword in description and returns the city