Filter Records by State
Filter Records by State
Filtering object arrays is about preserving whole records whose properties pass a test. The callback should decide whether a record stays, not build a new record.
This pattern shows up in admin tables, search results, and queues where the data source contains more records than the screen should show.
Your task: Complete getActiveUsers so it returns only users with active: true. The returned users should stay in their original order.
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 Records by State
Filtering object arrays is about preserving whole records whose properties pass a test. The callback should decide whether a record stays, not build a new record.
This pattern shows up in admin tables, search results, and queues where the data source contains more records than the screen should show.
Your task: Complete getActiveUsers so it returns only users with active: true. The returned users should stay in their original order.