Chapter 5

Harnessing the Power of Functions

IN THIS CHAPTER

Bullet Getting to know JavaScript functions

Bullet Creating and using custom functions

Bullet Passing and returning function values

Bullet Working with anonymous and arrow functions

Bullet Getting to the bottom of variable scope

Bullet Understanding recursive functions

To iterate is human, to recurse divine.

— L. PETER DEUTSCH

As I demonstrate throughout this book, JavaScript comes with a huge number of built-in features that perform specific tasks. For example, something called the Math object has a built-in method for calculating the square root of a number. Similarly, a feature called the String object has a ready-made method for converting a string value to all lowercase letters.

Hundreds of these ready-to-roll features perform tasks that range from the indispensable to the obscure. But JavaScript can't possibly do everything that you’d like or need it to do. ...

Get Web Coding & Development All-in-One For Dummies, 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.