Chapter 7. Advanced CoffeeScript Usage

We spent the previous chapter overhauling our application to be more modular and use classes. Now it's time to dig even deeper into CoffeeScript. In this chapter, we'll be looking at some advanced features of the language as well as some ways to use what we already know to write better, cleaner, and more powerful code. Think of this chapter as the gateway to becoming a CoffeeScript power user. We will:

  • Learn about the subtleties of context when invoking methods on objects
  • Learn an incredibly easy way to avoid repeating expensive operations by saving results in object state
  • Learn a helpful idiom for passing lots of options to a function

Getting our context right

Now that we're starting to deal with classes a lot ...

Get CoffeeScript Application Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.