title: How to use $.extend() with variables
body: <p>I'm trying to make a script to use multiple values in window.location.hash but i'm having a problem with the $.extend() function of jquery</p>
  
  <p>I've tried two ways, but both didn't work out.</p>
  
  <pre><code>var MultiHash = {
      params: {},
  
      getHash: function () {
          var hashString = document.location.hash.replace('#', '').split('&amp;');
  
          for (var i=0; i &lt; hashString.length; i++) {
              var key = hashString[i].split('=')[0];
              var value = decodeURIComponent(hashString[i].split('=')[1]);
  
              // First way
              var a = {key: value};
  
              // Second way
              var a = {};
              a[key] = value;
  
              $.extend(params, a);
          }
  
          return params;
      },
  
      ...
  }
  </code></pre>
  
  <p>Is anyone seeing the problem?</p>