Practical Functional JavaScript: Code Samples
These are the code samples from my Ajax Experience 2008 talk, Practical Functional JavaScript. Click on a line to view (and run) that sample.
I've written out some of what I said about the samples in the first section. Check back later, and I'll update the rest.— Oliver Steele, 2 Oct 2008, Amherst, MA
1. Function Objects
- Callbacks
- Basic callback
- The long syntax
- Reprise
- Local (nested) function
- Pyramid order
- Using the function value directly
- Anonymous functions
- Functions
- Function-valued returns
- Variable capture
- Two different argument lists
- Function-valued arguments
- Storing functions
- Function registries
- Unfiltered
- Filtering
- Filtering with guards
2. Function Construction Tools
- Closures
- Functions share variables
- Invocation create distinct variables
- Idioms
- Special variables
-
call and apply - Method call and apply
- Stealing a method the wrong way
- Using
apply to steal a method - Slice
- Passing arguments to a function
- Copying arguments to pass to a function
- Extending
Function's prototype
3. Case Studies: Callbacks