Filter Without Removing
Filter Without Removing
filter returns a new array and leaves the source array alone. That is different from removing items while looping, which can skip records and surprise later code that still expects the full source.
Mutation bugs are common in queues and moderation tools because the filtered view and the original data often live side by side. A correct filter keeps the matching tickets and preserves the full incoming list.
Your task: Fix openHighPriorityTickets so it returns tickets whose status is "open" and whose priority is at least 3. Do not mutate the provided ticket array.
Free with a JS Exercises account
Sign in to start coding, run your solution, and keep your progress saved for later. No payment needed.
By continuing, you agree to our Terms and Privacy Policy. We'll send occasional product updates and news. You can unsubscribe anytime.
Filter Without Removing
filter returns a new array and leaves the source array alone. That is different from removing items while looping, which can skip records and surprise later code that still expects the full source.
Mutation bugs are common in queues and moderation tools because the filtered view and the original data often live side by side. A correct filter keeps the matching tickets and preserves the full incoming list.
Your task: Fix openHighPriorityTickets so it returns tickets whose status is "open" and whose priority is at least 3. Do not mutate the provided ticket array.