You are previewing Secrets of the JavaScript Ninja.

Secrets of the JavaScript Ninja

Cover of Secrets of the JavaScript Ninja by John Resig and Bear Bibeault Published by Manning Publications
O'Reilly logo

Chapter 4. Wielding functions

This chapter covers

  • Why anonymous functions are so important
  • The ways that functions can be referenced for invocation, including recursively
  • Storing references to functions
  • Using the function context to get our way
  • Dealing with variable-length argument lists
  • Determining whether an object is a function

In the previous chapter, we focused on how JavaScript treats functions as first-class objects, and how that enables a functional programming style. In this chapter, we’ll expand on how to use those functions to solve various problems that we might come across when authoring web applications.

The examples in this chapter were purposefully chosen to expose secrets that will help you to truly understand JavaScript ...

The best content for your career. Discover unlimited learning on demand for around $1/day.