One-to-Many Transforms
One-to-Many Transforms
A single record often contains a nested list. Orders contain items, courses contain lessons, and projects contain tasks.
flatMap fits when each outer record should produce zero, one, or many output values. It keeps the callback focused on one outer record while returning one flat result for the caller.
Your task: Complete getLineItemLabels so it returns one label for every item in every order. Each label should include the order id, item sku, and quantity.
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.
One-to-Many Transforms
A single record often contains a nested list. Orders contain items, courses contain lessons, and projects contain tasks.
flatMap fits when each outer record should produce zero, one, or many output values. It keeps the callback focused on one outer record while returning one flat result for the caller.
Your task: Complete getLineItemLabels so it returns one label for every item in every order. Each label should include the order id, item sku, and quantity.