The Data Wrangler
All guides

JavaScript data transformations at a glance

A short replacement for the historical reference with an original filter and map example and a link to Ashley Davis’s companion sheet.

The original JavaScript cheat sheet helped readers move between the syntax in the book and small pieces of runnable code. Its companion repository remains a useful source. Here is one way to check a transformation before applying it to a longer array. Ashley Davis’s companion sheet repository.

Check the order of filter and map

Use a small array whose output you can predict. [5, 1, 9].filter(n => n > 4).map(n => n * 2) keeps the values 5 and 9, then makes them 10 and 18. If you reverse the operations in another exercise, write the intermediate array down first. The filter would then test transformed values, which may answer a different question.

Keep a case that checks an empty input and another with a value exactly on the boundary. A short reference is most useful when you can connect each method to the question your pipeline is asking. MDN Array reference.