Chapter 6. WRITING YOUR OWN JAVASCRIPT FUNCTIONS

In this chapter we're going to focus on a programming concept—writing your own functions. Knowing how to write your own functions will improve almost any JavaScript you create. In fact, you'll see how custom-made functions can enhance several of the JavaScript tricks you've already learned.

In this chapter, you'll learn how to:

  • Write your own functions

  • Use homemade functions to improve your code

  • Write functions you can cut and paste into whatever pages you want

We'll be using homemade functions in every chapter from now on, so pay extra-close attention to what's going on in this chapter. You'll be glad you did.

Functions as Shortcuts

Functions aren't anything new. You've already seen a number of functions ...

Get The Book of JavaScript, 2nd Edition now with O’Reilly online learning.

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