From Comprehensions to JavaScript Array Methods (Summary)

Congratulations, you made it to the end of the course! The timing desk’s results cleaner now runs in JavaScript. You rebuilt its report one expression at a time, then calculated the average and found the fastest finisher in each age group in the last exercise.

The race export still identifies bibs 23 and 58 as finishers with a missing chip read. The average remains 95.6 minutes, and the group winners are Priya Nair, Mei Chen, and Tom Okafor. At the starting gun, before anyone has finished, the completed port prints an average of 0.0 minutes and no group lines, as the Python version does.

In this course, you learned how to:

  • Build a chain that keeps records with .filter() before transforming them with .map()
  • Pass a function to .map() that handles the arguments it receives and returns a value
  • Build an object or a Map from pairs, collect distinct values with Set, and flatten mapped arrays with .flatMap()
  • Destructure arrays by position and objects by name, with a rest element or a default where needed
  • Spread items into arrays and function calls, and copy properties into an object
  • Ask whether any or all items pass a test, and find the first match with .find()
  • Total values with .reduce() and an initial value, find a minimum value, or keep the best record

Keep the Habits That Make the Report Work

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.