• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 12. Functions > The Arguments Class

The Arguments Class

Each time a function is invoked, an Arguments object is created automatically, and can be referenced using the local variable arguments, which is automatically included within the scope of the function. Basically, arguments are the parameters you define when you invoke any function. The arguments variable of any function is more like an array (refer to Chapter 13, “Arrays,” for more on arrays). And as with an array, you can call specific parameters as well as the number of total parameters. The arguments variable can be used to get information about any and all of the parameters being passed to that function. You might want to double-check to make sure the user has passed the correct number of parameters or the correct type of parameters.

Let's start with the number of arguments in a given function. Gathering this information is as easy as using the length property of the arguments object.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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