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