Function arguments (Definition)

The parameters that are passed to a function as it is called.

When values are passed to a function as it is called, primitive values are passed by value. This means that from inside the function you see a copy of the value and cannot damage the one outside.

Objects are passed by reference. If you modify the properties of an object that is passed into a function by way of an argument, you will be modifying the master instance of that object because there is only one.

This means that calling a function can have side effects that you may not expect unless you realize that this is happening.

See also:Arguments object, arguments[], Function.arguments[], Reference, Reference counting, Variable


Wrox Instant JavaScript - page - 27

Wrox Instant JavaScript - page - 29