JavaScript Video Cheatsheets: map() and reduce() with Arrays
Today we're introducing a new series here on Blixt Dev: JavaScript Video Cheatsheets. These instructional videos are quick references on how to use common JavaScript techniques. In these first videos, we'll cover two extremely useful methods for manipulating JavaScript arrays: map()
and reduce()
.
map() with JavaScript Arrays
map()
lets you transform a JavaScript array by iterating over the elements and applying a transformation using a function. The method returns a new list (instead of modifying the existing one), and can be chained together with other methods to build functional computation pipelines.
For more info on using map()
, see the video cheatsheet below!
reduce() with JavaScript Arrays
reduce()
is a JavaScript array method that lets you perform some computation while iterating over the elements of an array. It pairs well with map()
and other functional methods to create robust and easy to read computational pipelines.
For more info on using reduce()
, here's the video cheatsheet:
See More JavaScript Video Cheatsheets
These two videos are just the first in the series of JavaScript Video Cheatsheets. We'll be posting new videos every week. To get access, subscribe to the Blix Dev YouTube channel.