Chapter 4
Using Functions
Key Skills & Concepts
    What a Function Is
    Why Functions Are Useful
    Structuring Functions
    Calling Functions in Your Scripts
image
As a JavaScript coder, you need to know how to use functions in your scripts. Functions can make your scripts more portable and easier to debug.
This chapter covers the basics of using functions. First, you will find out what a function is and why functions are useful. Then, you will learn how to define and structure functions. Finally, you will learn how to call functions in your scripts.
What a Function Is
A function is basically a little script within a larger script. Its purpose ...

Get JavaScript: A Beginner's Guide, Fourth Edition, 4th Edition now with O’Reilly online learning.

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