Map to New Objects
Map to New Objects
map can transform an object array without editing the original objects. That makes it a good fit for normalization steps where incoming records need a cleaner shape before validation or rendering.
The important boundary is reference safety. If the callback edits each subscriber object directly, later code that still holds the raw import will see those edits too. A safer transformation returns a new object for each source record and copies only the fields the next step needs.
Your task: Complete normalizeSubscribers so it returns new subscriber objects. Each result should keep id, include an email that is trimmed and lowercased, and include active set from whether the source status is "active". Do not mutate the original subscriber objects.
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.
Map to New Objects
map can transform an object array without editing the original objects. That makes it a good fit for normalization steps where incoming records need a cleaner shape before validation or rendering.
The important boundary is reference safety. If the callback edits each subscriber object directly, later code that still holds the raw import will see those edits too. A safer transformation returns a new object for each source record and copies only the fields the next step needs.
Your task: Complete normalizeSubscribers so it returns new subscriber objects. Each result should keep id, include an email that is trimmed and lowercased, and include active set from whether the source status is "active". Do not mutate the original subscriber objects.