Changing Function Parameters and Object Properties

Parameters are passed to functions by a value. If a function changes the value of a parameter, the change is not reflected globally or in the calling function. If you pass an object as a parameter to a function and the function changes the properties of the object, the change is visible outside the function.

Example:

function myFunc(theObject) {
  theObject.make="Toyota"
}
mycar = {make:"Honda", model:"Accord", year:2004}
x=mycar.make // returns Honda
muffin (mycar) // pass object mycar to the function
y=mycar.make // returns Toyota (property was changed by the function)