Building Blocks of ExpressJS/Level 5/5.2 Route Instance/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 result = null;
  var search = RegExp(keyword, 'i');
  for(var city in cities) {
    if(search.test(cities[city])) {
      return city;
    }
  }
}
function citySearch ( keyword ) { var result = null ; var search = RegExp ( keyword , 'i' ) ; for ( var city in cities ) { if ( search . test ( cities [ city ] ) ) { return city ; } } }
Searches for keyword in description and returns the city
Searches for keyword in description and returns the city