jscript array passing to functions 2004-07-05 - By OO's mailbot
Back JScript passes array and objects by reference, so you can change their contents, but you can't clobber the variable and pass that change back. for example:
var myArray = new Array(0,1,2); LogMessage(myArray);
ChangeValues(myArray); LogMessage(MyArray);
ClobberIt(myArray); LogMessage(myArray);
function ChangeValue(someArray) { someArray[0] = 'Zero'; someArray[1] = 'One'; someArray[2] = 'Two'; }
function ClobberIt(someArray) { someArray = new Array('A', 'B', 'C'); }
On Jul 6, 2004, at 2:05 AM, kim aldis wrote:
> By value or by reference? (too lazy to look it up)
--- Unsubscribe? Mail Majordomo@(protected) with the following text in body: unsubscribe xsi
|
|