title: Hash table in JavaScript
body: <p>I am using a hash table in JavaScript, and I want to show the values of the following in a hash table</p>
  
  <pre><code>one   -[1,10,5]
  two   -[2]
  three -[3, 30, 300, etc.]
  </code></pre>
  
  <p>I have found the following code. It works for the following data.</p>
  
  <pre><code>   one  -[1]
     two  -[2]
     three-[3]
  </code></pre>
  
  <p>How do I assign one-[1,2] values to a hash table and how do I access it?</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function Hash()
      {
          this.length = 0;
          this.items = new Array();
          for (var i = 0; i &lt; arguments.length; i += 2) {
              if (typeof(arguments[i + 1]) != 'undefined') {
                  this.items[arguments[i]] = arguments[i + 1];
                  this.length++;
              }
          }
  
          this.removeItem = function(in_key)
          {
              var tmp_value;
              if (typeof(this.items[in_key]) != 'undefined') {
                  this.length--;
                  var tmp_value = this.items[in_key];
                  delete this.items[in_key];
              }
              return tmp_value;
          }
  
          this.getItem = function(in_key) {
              return this.items[in_key];
          }
  
          this.setItem = function(in_key, in_value)
          {
              if (typeof(in_value) != 'undefined') {
                  if (typeof(this.items[in_key]) == 'undefined') {
                      this.length++;
                  }
  
                  this.items[in_key] = in_value;
              }
              return in_value;
          }
  
          this.hasItem = function(in_key)
          {
              return typeof(this.items[in_key]) != 'undefined';
          }
      }
  
      var myHash = new Hash('one',1,'two', 2, 'three',3 );
  
      for (var i in myHash.items) {
          alert('key is: ' + i + ', value is: ' + myHash.items[i]);
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>How do I do it?</p>