joetesta
13 years agoRoku Guru
array pass by value?
Hello -
I have an array (of shows) and I'm trying to create a parallel array that has one field different (no show description in 2nd array). So far whatever I try has the effect of altering both arrays. I tried setting newArray = oldArray, then when I modify the elements of newArray it also affects oldArray. I also tried looping over oldArray and Push'ing the elements to newArray, then loop over newArray and modify the field. Unfortunately oldArray's fields were also modified. It seems like there must be a way to do this without modifying the oldArray?
tyvmia
I have an array (of shows) and I'm trying to create a parallel array that has one field different (no show description in 2nd array). So far whatever I try has the effect of altering both arrays. I tried setting newArray = oldArray, then when I modify the elements of newArray it also affects oldArray. I also tried looping over oldArray and Push'ing the elements to newArray, then loop over newArray and modify the field. Unfortunately oldArray's fields were also modified. It seems like there must be a way to do this without modifying the oldArray?
tyvmia