O'Reilly logo

Modern JavaScript: Develop and Design by Larry Ullman

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

7. Creating Functions

In the past couple of chapters, you’ve used several functions built into JavaScript, but now it’s time to start writing your own. Out of necessity, Chapter 2, JavaScript in Action, explained how to write a most basic function, but in this chapter you’ll learn all the particulars of user-defined functions. Not only are user-defined functions necessary in JavaScript for event handling, but, as in any language, being able to create your own functions constitutes a huge step toward creating modular and easily reusable code. The chapter begins with the fundamentals, and slowly works its way into the more advanced concepts.

The Fundamentals

This chapter starts by walking through the basics of functions in JavaScript. Not only ...

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