Higher Order Functions

Map to Display Data

Map to Display Data

Mapping object arrays is a common step between stored data and UI text. Each source object stays intact, while the returned array contains the shape the next piece of code needs.

The important decision is what one item becomes. Once that callback is correct, the method repeats it across the whole array.

Your task: Complete formatProductLabels so it returns display labels for every product. Each label should contain the product name and price with a dollar sign. Do not change the product 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 Display Data

Mapping object arrays is a common step between stored data and UI text. Each source object stays intact, while the returned array contains the shape the next piece of code needs.

The important decision is what one item becomes. Once that callback is correct, the method repeats it across the whole array.

Your task: Complete formatProductLabels so it returns display labels for every product. Each label should contain the product name and price with a dollar sign. Do not change the product 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.

Console

Run code to see output.