HTML and CSS Reference
In-Depth Information
Figure 7.22 Example of output for Example 7.13.
7.3 What You Should Know
Functions are fundamental to programming in any programming language. There are
JavaScript built-in functions such as eval() , parseInt() , and Number() , among others, and
there are user-defined functions. This chapter was all about defining and calling your
own functions. We will be creating functions throughout the rest of this text to perform
tasks based on user-initiated events such as clicking a link, clicking a button, rolling a
mouse over an image, or submitting a form. Functions will be defined within JavaScript
code or from another file. They may be used to create objects, respond to HTTP requests,
validate data, perform calculations, customize output, and so on. After reading this
chapter, you should know:
1. How to declare and define functions.
2. Where to put functions in a JavaScript program.
3. How to call a function with arguments and use parameters.
4. What can be returned from a function.
5. The difference between global and local variables.
6. How to trigger a function call.
7. How to assign a function to a variable.
8. What closure is.
9. What recursion is.
10. How try and catch work.
11. How to debug programs with browser tools.
Search WWH ::

Custom Search