5  Functions

In this chapter, you will learn about functions, various ways to work with functions, and variable scope. Functions allow you to write code in a way that avoids repetition. They also allow you to encapsulate your code and perform a specific task based on a set of inputs. Scope pertains to the context in which variables are declared. JavaScript handles variables differently depending on their scope, and you will learn how to use variables in functions when writing programs.

Images  Functions—A Simple Example

To explain functions, let’s look at the design of an audio effects module. Imagine a simple hardware audio effects box equipped with ...

Get JavaScript for Sound Artists 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.