O'Reilly logo

Test-Driven JavaScript Development by Christian Johansen

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 5. Functions

JavaScript functions are powerful beasts. They are first class objects, meaning they can be assigned to variables and as properties, passed as arguments to functions, have properties of their own, and more. JavaScript also supports anonymous functions, commonly used for inline callbacks to other functions and object methods.

In this chapter we will cover the somewhat theoretical side of JavaScript functions, providing us with the required background to easily dive into the more interesting uses of functions as we dig into into closures in Chapter 6, Applied Functions and Closures, and methods and functions as a means to implement objects in Chapter 7, Objects and Prototypal Inheritance.

5.1 Defining Functions

Throughout ...

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