O'Reilly logo

CoffeeScript in Action by Patrick Lee

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 3. First-class functions

This chapter covers

  • Functions for representing computation
  • Functions for events and event-driven I/O
  • An introduction to higher-order functions
  • Variable scope and closures

If you asked a dozen JavaScript programmers what they thought JavaScript got wrong, you’d probably get a dozen different answers. If you asked those same dozen people what JavaScript got right, they’d probably all answer, “First-class functions.” What does it mean that JavaScript has first-class functions, why does it matter, and how does CoffeeScript make functions even better? All will be answered in good time. First, though, what exactly is a function?

A function defines a transformation of input values called parameters to an output ...

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