Can an object automatically delete itself in javascript once it has achieved its purpose?
I am wondering if it is possible for an object in javascript to delete itself once it has finished its task.

For example, I have the following object...

        var myObject = Object.create(baseObject);
        
        myObject.init = function() {
        
           /* do some stuff... */
        
           delete this;
        
        }
    
        myObject.init();



Does this work?  If not, is there another way?

Thanks,
Can an object automatically delete itself in javascript once it has achieved its purpose?
===

I am wondering if it is possible for an object in javascript to delete itself once it has finished its task.

For example, I have the following object...

        var myObject = Object.create(baseObject);
        
        myObject.init = function() {
        
           /* do some stuff... */
        
           delete this;
        
        }
    
        myObject.init();



Does this work?  If not, is there another way?

Thanks,