27: Applying Functions

You don't have to use anonymous callback functions for data transformation. You can pass in more complex full functions to do the processing you need. You can also chain together calls to map, reduce, filter, and find to perform your transformations. In this code I do the calculation I want at the very end in one sequence of calls. You'll find when you get to Promises that this is a common pattern.

You'll also see I threw in a debug function, which is a handy trick for debugging these chains. All it does is print what it's given and return it.

The Code

{{ ork.js() }}

Learn JavaScript Today

Register today for the Beginner Basics course and get the new releases by just paying the difference. There's also special discounts for existing customers when new courses are released.

Still Not Sure? Check out more curriculum!