Pushing reference of an object to array

Posted by intacto on Stack Overflow See other posts from Stack Overflow or by intacto
Published on 2010-04-23T08:25:06Z Indexed on 2010/04/23 8:33 UTC
Read the original article Hit count: 225

Filed under:
|
|

As far as i can see in a situation like this:

var x = []; var y = {};

y.someProp='asd';

This doesnt work: x.push(y);

What I want to do is add a reference of y to x so that later if I will "delete y;" I want it also to be removed from the array x.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about objects