Chapter 7. Working with Functions
After reading this chapter, you'll be able to
Understand the purpose of functions in JavaScript.
Define your own functions.
Call functions and receive data back from them.
Understand some of the built-in functions in JavaScript.
What's in a Function?
A JavaScript function is a collection of statements, either named or unnamed, that can be called from elsewhere within a JavaScript program. Functions can accept arguments or input values that are passed into the function. Within a function, those arguments passed into the function can be acted upon and then passed back out of the function through a return value.
Functions are perfect for when you have something that needs to happen multiple times within a program. Rather ...
Get JavaScript Step by Step 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.