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