Chapter 2. Arming with testing and debugging
Listing 2.1. A simple logging method that works in all modern browsers
Listing 2.2. A simple page that uses the custom log() method
Listing 2.3. A reduced DOM test case for jQuery
Listing 2.4. A simple implementation of a JavaScript assertion
Listing 2.5. An implementation of test grouping
Listing 2.6. A simple asynchronous test suite
Chapter 3. Functions are fundamental
Listing 3.1. Proving things about the way that functions are declared
Listing 3.2. Observing the scoping behavior of declarations
Listing 3.3. Illustrating the differences between function and method invocations
Listing 3.4. Using a constructor to set up common objects
Listing 3.5. Using the apply() and call() methods to supply the function context
Listing 3.6. Building a for-each function to demonstrate setting a function context
Chapter 4. Wielding functions
Listing 4.1. Common examples of using anonymous functions
Listing 4.2. Chirping using a named function
Listing 4.3. Method recursion within an object
Listing 4.4. Recursion using a missing function reference
Listing 4.5. Using an inline function in a recursive fashion
Listing 4.6. Verifying the identity of an inline function
Listing 4.7. Using arguments.callee to reference the calling function
Listing 4.8. Storing a collection of unique functions
Listing 4.9. Memoizing previously computed values
Listing 4.10. Simulating array-like methods
Listing 4.11. Generic min() and max() functions for arrays