I'm a little dusty on my pointers and call by reference in JS...
What I want to do is create an array containing a subset of another array. Each entry in the array is an object with several properties.
Does the following work, as far as creating a whole new copy of an element? (I'm not using slice because these elements are not located contiguously in the array)
subArray.push(bigArray[id]);
And let's say I want to delete all elements in bigArray that are contained in subArray? Will this work?
if(subArray == bigArray[j]) {bigArray.splice(j,1);}
I'm guessing it won't since the if statement is comparing memory locations...so I'll have to do something like:
if(subArray.property1 == bigArray[j].property1){bigArray.splice(j,1);}
What I want to do is create an array containing a subset of another array. Each entry in the array is an object with several properties.
Does the following work, as far as creating a whole new copy of an element? (I'm not using slice because these elements are not located contiguously in the array)
subArray.push(bigArray[id]);
And let's say I want to delete all elements in bigArray that are contained in subArray? Will this work?
if(subArray == bigArray[j]) {bigArray.splice(j,1);}
I'm guessing it won't since the if statement is comparing memory locations...so I'll have to do something like:
if(subArray.property1 == bigArray[j].property1){bigArray.splice(j,1);}