• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Using Functions

The scripts you've seen so far are simple lists of instructions. The browser begins with the first statement after the <script> tag and follows each instruction in order until it reaches the closing <script> tag (or encounters an error).

While this is a straightforward approach for short scripts, it can be confusing to read a huge script written in this fashion. To make it easier for you to organize your scripts, JavaScript supports functions, which you learned about in Hour 4, “How JavaScript Programs Work.” In this section you will learn how to define and use functions.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint