Skip to content

Instantly share code, notes, and snippets.

@katepapineni
Created July 30, 2020 15:34
Show Gist options
  • Save katepapineni/f2616d3a6b1634fdd1641531042ebe82 to your computer and use it in GitHub Desktop.
Save katepapineni/f2616d3a6b1634fdd1641531042ebe82 to your computer and use it in GitHub Desktop.
const flights = [
{ route: 'Frankfurt to Hong Kong', hours: 11.5 },
{ route: 'San Fransisco to Delhi', hours: 15.75 },
{ route: 'Singapore to Paris', hours: 13.5 },
{ route: 'Delhi to Dubai', hours: 4 },
];
const findFlights = (city) => {
return (flight) => {
return flight.route.includes(city);
}
}
// What's the output?
console.log(flights.find(findFlights('Delhi')).route);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment