on-internet
← Community

When should I use delete vs setting elements to null in JavaScript? [duplicate]

Stack Overflow ·

Possible Duplicate: JS delete operator and garbage collection I have a JS object having a large number of properties. If I want to force the browser to garbage collect this object, do I need to set each of these properties as null or do I need to use the delete operator? What's the difference between the two?

Comments

Sign in or sign up to comment and upvote.

No comments yet.