title: Create table with Javascript array and object
body: <p>I have one array and one object:</p>
  
  <pre><code>labels = ['ID','Name']; 
  object = {
      ["id": "1", 'name': "richard"],
      ["id": "2", 'name': "santos"]
  };
  </code></pre>
  
  <p>and I have to create a table like this:</p>
  
  <pre><code>&lt;table&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;td&gt;ID&lt;/td&gt;
          &lt;td&gt;Name&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/thead&gt;
  &lt;tbody&gt;
      &lt;tr&gt;
          &lt;td&gt;Richard&lt;/td&gt;
          &lt;td&gt;Santos&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p></p>
  
  <p>The problem is that: 
  <br>The "object" variable sometimes could have different key names so I have to create this table dynamically with other objects, I'm trying to do this all day but no success, can anyone help me? I'm new to Javascript.
  obs: the label and the object vars always have the same size.</p>
  
  <p>Some kind of objects.</p>
  
  <pre><code>var labels = ['ID','NOME'];
  var object = {
      ["id": "1", 'nome': "richard"],
      ["id": "2", 'nome': "adriana"]
  };
  
  var labels = ['ID','NAME', 'PLATE'];
  var object = {
      ["id": "1", 'nome': "jetta",  'plate': "DFG-1222"],
      ["id": "2", 'nome': "fusion", 'plate': "DFF-3342"]
  };
  </code></pre>