5 FUNCTIONS
As you learned in Chapter 1, a function is a self-contained block of code for performing a certain task. We’ve already used some of JavaScript’s built-in functions, such as alert and console.log, but you can also create your own custom functions to perform the tasks particular to your application. Then you can call these functions to run the associated code. Packaging code into functions in this way makes your programming more effective, as you don’t have to repeat the code every time you want to use it.
In this chapter, you’ll learn different techniques for writing your own functions. You’ll see how to provide input to functions ...
Get JavaScript Crash Course 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.