code: function selectedCities(travelData, cities) {
    var selected = [];
    travelData.activities.forEach((data) => {
      const isSelected = cities.includes(data.location.city);
  
      // check if the city already exists in our cities array
      var existsIdx = -1;
      selected.forEach((city, idx) => {
        if (city.name === data.location.city) {
          existsIdx = idx;
        }
      });
  
      const city = travelData.cities.find((city) => city.name === data.location.city);
  
      // if it doesn't exist already, add it
      if (existsIdx === -1) {
        selected.push({
          img: city ? city.img : '',
          name: data.location.city,
          isSelected: isSelected,
        });
      // otherwise update the existing entry only if it's currently false,
      // otherwise we could overwrite a previous match
      } else {
        if (!selected[existsIdx].isSelected) {
          selected[existsIdx].isSelected = isSelected;
        }
      }
    });
  
    return selected;
  }
docs: Checks to see if any the given cities exist in our travel data,
  returning all the ones that are.
  
  @param {Array} travelData - Array of objects containing the travel data to
  filter.
  @param {Array} cities - Array of strings containing city names.
  @return {Array} The selected cities.