title: Hashtable functionality using objects in JavaScript
body: <p>Okay, I have the following scenario: I get an object, which is an array with lists. There is always 3 items in the array.</p>
  
  <p>The items inside the lists, has a specific field I am interested in (ISBN13).</p>
  
  <p>I want to build a table like this using JavaScript:</p>
  
  <pre><code>&lt;table&gt;
      &lt;tr&gt;
          &lt;td&gt;Array_1_Item_1_ISBN13&lt;/td&gt;
          &lt;td&gt;Array_2_Item_1_ISBN13&lt;/td&gt;
          &lt;td&gt;Array_3_Item_1_ISBN13&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;Array_1_Item_2_ISBN13&lt;/td&gt;
          &lt;td&gt;Array_2_Item_2_ISBN13&lt;/td&gt;
          &lt;td&gt;Array_3_Item_2_ISBN13&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>In C#, I would just build a dictionary, and:</p>
  
  <ul>
  <li>If I've seen the key before, add a new key</li>
  <li>If I have seen the key before, continue building the string</li>
  </ul>
  
  <p>But now I am in jQuery/JS land, and meh.</p>
  
  <p>Below, I have tried to create an object, I use to fill data in. This code have the following issues:</p>
  
  <ul>
  <li>Instead of adding an entry to the object at key isbn13, it adds object.isbn =  ...</li>
  <li><p>Not sure if the if() statement works</p>
  
  <pre><code>function setBookTableFromProducts(data) {
  var outputArray = {};
  
  // list is an array of books, e-books and audiobooks)
  $.each($.parseJSON(data), function (index, value) {
      // single type of book
      $.each(value, function (index_inner, book) {
          var isbn13 = book.ISBN13;
          if (outputArray.isbn13 == null) {
              var newRowStr = '&lt;tr&gt;';
              newRowStr += '&lt;td&gt;' + book.ISBN13 + '&lt;/td&gt;';
              outputArray.isbn13 = newRowStr;
          } else {
              outputArray.isbn13 += '&lt;td&gt;' +book.ISBN13+ '&lt;/td&gt;';
          }
  
      });
  });
  
  $.each(outputArray, function (index, trArr) {
      trArr += '&lt;/tr&gt;';
      $('#bookTable').append(trArr);
  });
  </code></pre>
  
  <p>}</p></li>
  </ul>
  
  <p>How would you solve this issue? What is wrong with my code? (Oh, and performance doesn't matter)</p>