Demonstration of parameter passing in JavaScript

Passing a single variable as a parameter

Consider the following function, doVar, that accepts an int as a parameter, modifies the contents of the var and returns the modified var.
function doVar(x) { x++;
return x;
}//end doVar
Now consider the javascript code that initializes an integer and passes it to function, doVar
var y = 1;
var z = doVar(y);

Passing an array as a parameter

Consider the following function, doArray, that accepts an int array as a parameter, modifies the contents of the array and returns the modified array
function doArray(A) { for(i=0; i<=2; i++) { A[i]++;
}//end for
return A
}// end doArray
Now consider the javascript code that initializes an array and passes it to function, doArray.
var B = new Array(1, 2, 3);
var C = doArray(B);