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 ...
Get Prototype and Scriptaculous in Action now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.