Kyle continues his demonstration of the solution to exercise 4. He creates a function that takes an array of values and adds them together using the add2() function.
(bright music)…- [Student] Can we not call add inside that?…- We are calling add right here on line 12.…- [Student] Oh, okay.…- Okay?…Alright, now it starts to get more interesting,…and a little more challenging.…We'll see how close you've been paying attention.…I now want you, 'cause we have this add two function…which takes two functions.…
And, if I wanted to be able to take three functions…I could make an add three, or an add four, or an add five,…but I want you to make an add n.…I want you to make a function that takes…a list of an arbitrary number of functions…and adds all of those function return results together,…but that function has to use add two.…There's a variety of ways that you could define your add n.…
Let's just leave the add two here,…so that we see that in comments.…There's a variety of ways to define…the add n that we're talking about.…But, what I want you to do is instead of it receiving…parameters, it's going to receive a single array.…So, I'll give you that hint.…It's going to receive a single array.…
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?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.