O'Reilly logo

Prototype and Scriptaculous in Action by Tom Locke, Bear Bibeault, Dave Crane

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Fun with Functions

This chapter covers

  • Understanding JavaScript functions
  • Function context and closures in JavaScript
  • Working with closures using Prototype

In chapter 8, we looked at the JavaScript Object type in some detail. Coming to it with the expectations of object-oriented programmers, we were surprised to see how little resemblance it bore to the objects of mainstream OO programming. In this chapter, we’re going to look at the JavaScript Function from a similar perspective.

Functions look a bit like class methods, but they are really quite different. As with the Object, Prototype extends the capabilities of the Function in quite elegant ways. The crown jewel of Prototype’s support for functions is its ability to make closures ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required