Map array to values

Map array to values in JavaScript — with the four heights of help laid out: do it now, make it easier for the next person to accept, work out the right move when you are stuck, and learn the pattern so it stops coming back.

4prompt heights
Open it in the interactive atlas →

The four heights

The same task, four distances: today's deadline, the next reviewer, the stuck moment, the pattern.

Execute — do the immediate task

+
I have an array of product objects and need an array of just their prices to feed into a chart.…
I have an array of product objects and need an array of just their prices to feed into a chart. Produce code that maps the products array to an array of numeric prices, converting strings to numbers and falling back to 0 for missing price fields. Keep it a one-liner I can drop into renderChart.

Improve — make it easier to accept

+
Before I hand the mapping to design, make it obvious where prices come from. Put the prices array…
Before I hand the mapping to design, make it obvious where prices come from. Put the prices array at the top of the snippet, show the string-to-number conversion and the fallback, and flag any products missing a price so reviewers can ask the API team. Keep comments minimal and the transformation readable.

Decide — diagnose the stuck moment

+
I mapped product.price directly and the chart displayed NaN for some entries. The product owner,…

Chart showed NaN values after mapping

I mapped product.price directly and the chart displayed NaN for some entries. The product owner, Maria, will complain the numbers don’t add up. I don’t know whether the API sometimes sends empty strings, null, or malformed values. What’s the likely root cause and the fastest fix for the mapping so the chart remains stable?

Become — change the pattern

+
Across several front-end pages we repeatedly map objects to values without consistent parsing,…

Mapping inconsistently across components

Across several front-end pages we repeatedly map objects to values without consistent parsing, leading to NaN, undefined, and display bugs. It costs time tracking down where a bad value slipped in. Which habit should we change to stop this: centralise parsing at the API boundary, always map with a sanitizer util, or add type checks? Recommend one change and how to roll it out with minimal churn.

Next to this one

Other programming language work people do in JavaScript.

Every task here came from the work, not from a feature list — which is why the prompts name what you want done and never the button that does it. The tool changes; the work does not.
Copyright © LLOS.ai · 2026 — original pedagogy, voice, and design — all rights reserved.

The rest of the map

Same library, five ways in.