Given the following two data structures describing projects and developers at a company C. As C is a highly successful and growing company, both arrays will grow in size as time progresses.
const developers = [
{ id: 'd1', name: "Kristof", projects: ['p1', 'p2'] },
{ id: 'd2', name: "Arvid", projects: ['p1', 'p2', 'p4'] },
{ id: 'd3', name: "Joren", projects: ['p3', 'p4'] },
];
const projects = [
{ id: 'p1', name: "Color Passport - The Digital One" },
{ id: 'p2', name: "In The Pocket - Smart City App" },
{ id: 'p3', name: "Teamleader - App" },
{ id: 'p4', name: "Apporto - Social Shopping App" },
];
Write a JavaScript function that returns an array containing the names of all projects on which a specific developer has contributed.
- Your approach returns the correct value given valid inputs.
- Your implementation uses a functional programming style.
- Your solution has a linear time complexity.