1099Chapter 41 .Functions and Custom Objects function gretel(x,y,z) (Hosting your own web site)

1099Chapter 41 .Functions and Custom Objects function gretel(x,y,z) { today = new Date() thisYear = today.getFullYear() hansel(x,y,z,thisYear) } When you load this page, the following results appear in the browser window (although the callerproperty values show undefinedfor NN6): hansel.caller is null hansel.arguments.length is 3 argument 0 is 1 argument 1 is two argument 2 is 3 hansel.caller is function gretel(x, y, z) { today = new Date(); thisYear = today.getFullYear(); hansel(x, y, z, thisYear); } hansel.arguments.length is 4 argument 0 is 4 argument 1 is five argument 2 is 6 argument 3 is 2001 (or whatever the current year is) As the document loads, the hansel()function is called directly in the body script. It passes three arguments, even though the hansel()function defines only two. The hansel.argumentsproperty picks up all three arguments just the same. The main body script then invokes the gretel() function, which, in turn, calls hansel() again. But when gretel() makes the call, it passes four parameters. The gretel() function picks up only three of the four arguments sent by the calling statement. It also inserts another value from its own calculations as an extra parameter to be sent to hansel(). The hansel.caller property reveals the entire content of the gretel()function, whereas hansel.arguments picks up all four parameters, including the year value introduced by the gretel() function. Neither the callernor argumentsproperties of a function object appear in the ECMA-262 Edition 3 specification. While NN6 dropped the callerproperty, it continues to support the arguments property probably because a lot of scripters use it. functionObject.caller
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

Leave a Reply