Map Callback Returns
Map Callback Returns
A map callback must return the transformed value for each item. Arrow functions with expression bodies return automatically, but arrow functions with braces need an explicit return.
This is a small syntax difference with a large data consequence: the result can have the right length while every item is undefined. That failure is easy to miss if tests only check array length.
Your task: Fix summarizeLessons so it returns one summary object per lesson. Each summary should keep id and add a readable label built from the title and duration. Do not mutate the original lesson 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 Callback Returns
A map callback must return the transformed value for each item. Arrow functions with expression bodies return automatically, but arrow functions with braces need an explicit return.
This is a small syntax difference with a large data consequence: the result can have the right length while every item is undefined. That failure is easy to miss if tests only check array length.
Your task: Fix summarizeLessons so it returns one summary object per lesson. Each summary should keep id and add a readable label built from the title and duration. Do not mutate the original lesson objects.