Transforming a list involves performing an operation on every value in that list. Kyle introduces the Array.map() method and explains how it can be used to create immutable list transformations. The new list of transformed values has a one-to-one mapping with the original list.
(bass and flute music)…- Alright, these next four I mention,…we're going to talk about dealing with lists.…This is a very common refrain that you'll hear…from a functional programmer.…We often times will express an operation…that we're going to do, as a list operation.…That's true even if there's only one value,…which is interesting.…Even if there's no values,…you could have an empty list that you express…an operation on, in which case nothing occurs.…
You could have that same list, have one value in it,…and now that operation only occurs on that one item,…or that list could have a million items in it,…and the operation's going to be performed across…all one million.…But the nice graceful thing is, if I always deal…with an operation in terms of a list context,…I don't need to special case all those places where…it might have no value, or only one value,…or a million values or a billion.…I don't need to special case anything…because the operation is, if it's defined as a…pure operation, it doesn't really matter, does it?…
This course was created by Frontend Masters. It was originally released on 03/08/2016. We're pleased to host this training in our library.
- Pure functions
- Manual composition
- Composition utility
- List operations
Skill Level Intermediate
1. Pure Functions
2. Composition and Immutability
3. Closure and Recursion
4. List Operations
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.