title: Accessing an object in JavaScript with argument of function
body: <p>I want to make a sort of "shopping list" in JS. I'm having trouble accessing the object with the argument of a function. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>shopList = {
    create: function createList(listName) {
      listName = {};
      listName["Banana"] = 2
    },
  
    output: function output(listName) {
      console.log(listName)
    },
  
  };
  
  shopList.create('list')
  shopList.output('list')</code></pre>
  </div>
  </div>
  </p>
  
  <p>When I run shopList.output 'list' is returned. How do I access the object over the argument? Hope this isn't a duplicate, been googling for hours now and didn't make any progress.</p>