Open this example in the interactive library
Source code
type Row = { name: string; picks: string[] };
const rows: Row[] = [
{ name: "Ada", picks: ["A", "C", "B"] },
{ name: "Kim", picks: ["C", "A", "B"] },
{ name: "Leo", picks: ["A", "B", "C"] },
];
const result = Math.min(...rows.map((r) => r.picks.indexOf("C") + 1));
console.log(JSON.stringify(result, null, 2));
Sample output
1
