Kyle walks through the solution to exercise 2.
(Samurai music)…- First off the read me says…we're going to need to care about only the first two…parameters passed in.…Quick easiest way to do that is to give those names.…You could of messed around with the arguments…array if you really wanted to,…but here I'm going to just cheat…and use just the two names,…which means if you pass in any other arguments,…I'm just going to ignore them, okay?…Now I need to return a function.…I'm going to be lazy and not give it a name…because it doesn't really matter here,…but function expressions generally should have names.…
That function as we see the way it's being used…if we look at the test cases,…if you will while it's being used,…doesn't take any arguments…so I don't need an argument here.…And the read me said that what we wanted to do with that…is add those two values together and return it,…so that's all we have to do.…Can we see that it's closed over both x and y,…the parameters act in this case like local variables…that have a value.…Those values don't change over time,…
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.