H
Hal Vaughan
I may have my terms mixed up (I'm not a professional programmer), but if I
do this:
var array1 = new Array("TestOne", "TestTwo", "TestThree", "TestFour");
var array2 = new Array();
var test1 = "ScalarOne";
var test2 = test1;
array2 = array1;
array2[0] = "SecondOne";
array1[1] = "FirstTwo";
test2 = "ScalarTwo";
test1 = "NewOne";
alert("First: " + array1);
alert("Second: " + array2);
alert("One: " + test1 + ", Two: " + test2);
both arrays are equal, but the string variables aren't. When I assign the
value of one array to another, is it only passed by reference or address?
Is this the same in all browsers, or a glitch?
I have a case where I have to work with a 3d array, and if I can count on
this working, it would save work in the long run, since I wouldn't have to
update the original 3d array after parts have been copied to a 2d array for
editing (if I edit it straight in the 3d array, I have to re-write a whole
set of routines designed for 2d arrays).
Thanks for any info.
Hal
do this:
var array1 = new Array("TestOne", "TestTwo", "TestThree", "TestFour");
var array2 = new Array();
var test1 = "ScalarOne";
var test2 = test1;
array2 = array1;
array2[0] = "SecondOne";
array1[1] = "FirstTwo";
test2 = "ScalarTwo";
test1 = "NewOne";
alert("First: " + array1);
alert("Second: " + array2);
alert("One: " + test1 + ", Two: " + test2);
both arrays are equal, but the string variables aren't. When I assign the
value of one array to another, is it only passed by reference or address?
Is this the same in all browsers, or a glitch?
I have a case where I have to work with a 3d array, and if I can count on
this working, it would save work in the long run, since I wouldn't have to
update the original 3d array after parts have been copied to a 2d array for
editing (if I edit it straight in the 3d array, I have to re-write a whole
set of routines designed for 2d arrays).
Thanks for any info.
Hal