JavaScript Filter Map Matriz de objetos

let flights = [
  { flightid: 11, aerodrome: ["aaa", "bbb"] },
  { flightid: 22, aerodrome: ["aaa", "ccc"] },
  { flightid: 33, aerodrome: ["ddd"] },
  { flightid: 44, aerodrome: ["ddd", "bbb"] }
];

let aerodromeAAA = flights.filter((f) => f.aerodrome.includes("aaa"));

console.log(
  `Total of ${flights.length} flights, flights with aerodrome='bbb' is ${aerodromeAAA.length}`
);

// "Total of 4 flights, flights with aerodrome='bbb' is 2"


console.log(`AAA aerodromes flight IDs: ${aerodromeAAA.map((a) => a.flightid).join(", ")}`);

// "AAA aerodromes flight IDs: 11, 22"
Angry Alpaca