"Cylix" <cy*******@gmail.comwrites:
Can javascript using pointer or pass variable by reference?
Not directly, but you can pass the reference to a mutable object to
hold a value:
function foo(x,yRef) {
yRef.value = x;
return x*2;
}
var ref = {};
var z = foo(2, ref)'
alert([z, ref.value]); // 4,2
Or I need to using object or Array to return the two values?
That's another possibility, and one I would prefer. If you really need
to return two values, do that, instead of sneaking one of the return
values out the back door :)
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'