Chapter 3. Getting functional

Introducing Functions

image with no caption

Get ready for your first superpower. You’ve got some programming under your belt; now it’s time to really move things along with functions. Functions give you the power to write code that can be applied to all sorts of different circumstances, code that can be reused over and over, code that is much more manageable, code that can be abstracted away and given a simple name so you can forget all the complexity and get on with the important stuff. You’re going to find not only that functions are your gateway from scripter to programmer, they’re the key to the JavaScript programming style. In this chapter we’re going to start with the basics: the mechanics, the ins and outs of how functions really work, and then you’ll keep honing your function skills throughout the rest of the book. So, let’s get a good foundation started, now.

Note

More on this as we progress through the book.

Get Head First JavaScript Programming 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.