title: JavaScript: Create and destroy class instance through class method
body: <p>I'm trying to figure out how to delete an object through a class method. I would like to be able to create a class that has a destroy method that releases the object from memory. So far, the research I've done has been inconclusive. I understand that garbage collection will eventually take care of the object, but I'd like a more definitive way to destroy it. Is this possible?</p>
  
  <pre><code>// class constructor
  var class = function () {
       this.destroy = function () {};
  };
  
  // instance
  var instance = new class();
  instance.destroy();
  console.log(instance); // should be null or undefined
  </code></pre>