O'Reilly logo

The Book of JavaScript, 2nd Edition by thau!

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

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