Fix missing return in `map` / `filter`
easy
undefined. Fix the missing returns without changing the overall intent of the pipeline.Solution idea
export default function summarizeOpenTickets(tickets){
return tickets
.filter(ticket => {
return ticket.open;
})
.map(ticket => {
return ticket.title.trim().toUpperCase();
});
}
Examples
summarizeOpenTickets([{ title: ' Bug ', open: true }, { title: 'Chore', open: false }]) // ['BUG']
summarizeOpenTickets([{ title: ' Docs ', open: true }, { title: ' Test ', open: true }]) // ['DOCS','TEST']Solution
Overview
export default function summarizeOpenTickets(tickets){
return tickets
.filter(ticket => {
return ticket.open;
})
.map(ticket => {
return ticket.title.trim().toUpperCase();
});
}
Similar questions
Guides
Preparing for interviews? Use Frontend Coding Challenges first, then move into a concrete Study Plan before targeted Company Prep.
Open frontend interview questionsBrowse JavaScript interview questionsOpen Essential 60Open Machine Coding HubOpen Frontend Coding ChallengesOpen System DesignOpen Interview Prep GuideOpen System Design BlueprintOpen Framework Prep PathsOpen Study PlansOpen JavaScript mastery study planOpen Company PrepOpen JavaScript Framework Prep Guide
Built in public
The code behind FrontendAtlas lives on GitHub. A star helps other frontend engineers find it.