Chapter 5
Harnessing the Power of Functions
IN THIS CHAPTER
Getting to know JavaScript functions
Creating and using custom functions
Passing and returning function values
Understanding recursive functions
Introducing JavaScript’s built-in 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.
There are, in fact, hundreds of these ready-to-roll features that 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. What happens if your web development project requires a particular task or calculation that isn’t part of the JavaScript ...
Get Web Coding & Development 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.