Thanks,
Dave
--
Michael Harris
MVP Scripting
"David Rettberg" <dret...@case-engineering.com> wrote in message
news:#j8$y4ny$GA.250@cppssbbsa03...
Try this:
<script>
<!--
function changeArray(theArray) {
theArray[1]=theArray[1]=1;
}
var a=new Array();
a[0]=0;
a[1]=0;
changeArray(a);
alert(a[1]);
// -->
</script>
Regards,
Armand
At http://msdn.microsoft.com/scripting/, find this:
Copying, Passing, and Comparing Data
JScript Tutorial
In Microsoft JScript, how data is handled depends on its data type.
By Value vs. By Reference
Numbers and Boolean values (true and false) are copied, passed, and compared
by value. When you copy or pass by value, you allocate a space in computer
memory and put the value of the original into it. If you then change the
original, the copy is not affected (and vice versa), because the two are
separate entities.
Objects, arrays, and functions are copied, passed, and compared by reference
under most circumstances. When you copy or pass by reference, you
essentially create a pointer to the original item, and use the pointer as if
it were a copy. If you then change the original, you change both the
original and the copy (and vice versa). There is really only one entity; the
"copy" is not actually a copy, it's just another reference to the data.
======================================================
[...] in COM terms, JScript passes
everything by value - including all the object types (String, Number, Array,
etc.)
The fact that to pass an object by value means to pass its address, and from
its address you can modify an objects properties, is merely an accidental
side effect. You still can't change _the object pointed to by a parameter_
in JScript as you can in VB / C++ / etc.
If you know the difference between a singly-indirect pointer and a
doubly-indirect pointer in C++ then you'll know what I mean.
Peter
--
Peter J. Torr - Microsoft Windows Script Program Manager
pt...@microsoft.com - http://msdn.microsoft.com/scripting/
Please do not e-mail me with questions - post them to this
newsgroup instead. Thankyou!
======================================================
--
Michael Harris
MVP Scripting
"Armand" <ali...@acutronic.com> wrote in message news:u2wj5vvy$GA.197@cppssbbsa04...
--
Michael Harris
MVP Scripting
"Armand" <ali...@acutronic.com> wrote in message news:#zLzBYxy$GA.197@cppssbbsa04...
Michael,
That was a response to the question: "How do you pass a string back from
COM in ASP?". So, if that's the question now, .... But, on the other hand,
if it's just jscript-to-jscript, ...
Regards,
Armand