Is it bad practice to not assign a new object to a variable?

Posted by Jeff on Stack Overflow See other posts from Stack Overflow or by Jeff
Published on 2010-04-07T17:02:51Z Indexed on 2010/04/07 17:13 UTC
Read the original article Hit count: 183

Filed under:

Is it bad javascript practice to not assign a newly created object to a variable if you're never going to access it?

For example:

for(var i=0;i<links.length;i++){
    new objectName(links[i]);
}

And again, I won't be accessing it, so there's no need for a variable to reference it.

© Stack Overflow or respective owner

Related posts about JavaScript