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

The ability to simplify means to eliminate the unnecessary so that the necessary may speak.

—HANS HOFMANN

Way back in Book 1, Chapter 1, I introduce two methods: alert() and document.write(). Although not part of the JavaScript standard (they come from separate Web APIs; refer to Book 4, Chapter 6), web browsers make them available so that you can use them in your JavaScript code. Both alert() and document.write() are examples of ready-to-run features that you can use without having to know anything about how they work internally.

When you combine all the built-in JavaScript features with all the Web ...

Get HTML, CSS, & JavaScript All-in-One For Dummies 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.