I'm sure that this is an easy question for JS experts out there. Unfortunately for me I'm not one of them.
I've got the following situation. I'm creating an array in function b that I populate with some new objects. I then return that array back to function a (which called function b).
When I iterate through the returned array, the contents are all undefined. Off the cuff I figure that the JS garbage collector is probably involved here. How would I go about fixing this?
Sincerely,
mj
function a()
{
var x = b();
for( var v in x ){
//print out v.id and v.name
}
}
function b()
{
var y = new Array();
var m = new Object();
var n = new Object();
m.id = 1;
n.id = 2;
m.name = "alpha";
n.name = "bravo";
y.push( m );
y.push( n );
return y;
}