title: Deleting object's reference itself inside a function of object in JavaScript
body: <p>I want to remove object itself by function of it from a object collection. If I code like below does it course to reference cycle or any other error.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const obj_collec={};
  
  function Obj(id){
      this.id=id;
      this.remove=function(){
          delete obj_collec[this.id]
      }
  }
  
  obj_collec['obj1'] = new Obj('obj1');
  console.log(obj_collec)
  
  obj_collec['obj1'].remove();
  console.log(obj_collec)</code></pre>
  </div>
  </div>
  </p>
  <p>I know that I can do that same thing with <code>delete obj_collec['obj1']</code>. But I want to know that what happens if I code like above.</p>