title: How to get the same behavior in an object when the value is copied to another variable
body: <p>In this console:</p>
  
  <p><a href="https://i.stack.imgur.com/4Fotv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4Fotv.png" alt="Console Image"></a></p>
  
  <p>When <code>B</code> is set to <code>A</code> but <code>A</code> was destroyed afterwards, <code>B.b()</code> throws an error because A is truly undefined.</p>
  
  <p>How can one avoid this?</p>
  
  <p><strong>PS:</strong> I am aware that I can simply <code>return this</code> (or change the function in some way) but that doesn't fulfill my purposes.</p>
  
  <p><strong>EDIT</strong>: How do I 'localise' and somehow tell javascript that by <code>A</code>, I mean <code>B</code> even if A is undefined, WITHOUT ALTERING THE FUNCTION ITSELF?</p>