title: why does `this` matter in this case?
body: <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 library = (function () {
    let myLibrary = [1, 2];
  
    function get() {
      return this.myLibrary;
    }
  
    return { myLibrary, get }
  })();
  
  console.log(library.get()); // [1, 2]
  
  library.myLibrary = [0];
  
  console.log(library.get()); // [0]</code></pre>
  </div>
  </div>
  </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 library = (function () {
    let myLibrary = [1, 2];
  
    function get() {
      return myLibrary;
    }
  
    return { myLibrary, get }
  })();
  
  console.log(library.get()); // [1, 2]
  
  library.myLibrary = [0];
  
  console.log(library.get()); // [1, 2]</code></pre>
  </div>
  </div>
  </p>
  
  <p>Only difference between these snippets is this line:</p>
  
  <p><code>return this.myLibrary;</code> vs <code>return myLibrary;</code></p>
  
  <p>First one is mutating the array inside the factory function, but the second one does not. But I do not understand the reason why the first code with <code>this</code> is working differently than the second one.</p>