title: i cant put a .JS into a table
body: <p>hello i am currently busy trying to get a .js file into a table now i have written a for loop but it doesnt show i will show u down below my code</p>
  
  <p>The Html/javascript Code</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;!DOCTYPE html&gt;
  &lt;html lang="nl-NL"&gt;
  &lt;head&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;meta name="description" content="Dit is de website van Gerard Van De Weijer Hobbyist en Vader van 3"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;link rel="stylesheet" href="css/website-papa.css"&gt;
  &lt;meta name="robots" content="index, nofollow"&gt;
  &lt;meta name="author" content="Gerard Van De Weijer"&gt;
  &lt;meta name="web-author" content="Pieter Van De Weijer"&gt;
  &lt;link rel="canonical" href="http://website-gerard.com"&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;script src="sources/tabledata.js"&gt;&lt;/script&gt;
    &lt;script&gt;
      function readJSON(persons)
      {
       var output = '';
       for (var i = 0; i &lt; persons.length; i++)
       {
       output += '&lt;td&gt;'+persons[i].firstname+'&lt;/td&gt;';
       }
       document.getElementsByClassName('firstname').innerHTML = output;
      }
    &lt;/script&gt;
  &lt;title&gt; Tables&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;!--dit is is een container--&gt;
   &lt;div id="container"&gt;
    &lt;header&gt;
    &lt;h1&gt;t02m91&lt;/h1&gt;
    &lt;div id="facebook"&gt;
    &lt;a href="https://www.facebook.com/gerard.vandeweijer.5"&gt;&lt;img src="images/facebook.png"&gt;&lt;/a&gt;
  
    &lt;/div&gt;
    &lt;/header&gt;
    &lt;nav&gt;
    &lt;ul&gt;
     &lt;li class="menuli"&gt;&lt;a href="index.html"&gt;Home&lt;/a&gt;&lt;/li&gt;
     &lt;li class="menuli"&gt;&lt;a href="Anchors.html"&gt;Anchors&lt;/a&gt;&lt;/li&gt;
     &lt;li class="current"&gt;&lt;a href="Tables.html"&gt;Tables&lt;/a&gt;&lt;/li&gt;
     &lt;li class="menuli"&gt;&lt;a href="Iframes.html"&gt;Iframes&lt;/a&gt;&lt;/li&gt;
     &lt;li class="menuli"&gt;&lt;a href="html5.html"&gt;HTML5&lt;/a&gt;&lt;/li&gt;
     &lt;li class="menuli"&gt;&lt;a href="contact.html"&gt;Contact&lt;/a&gt;&lt;/li&gt;
     &lt;li class="menuli"&gt;Opdrachten
     &lt;ul&gt;
     &lt;!-- ik kon er geen spatie in krijgen dus ik heb het zo gefixt ik leg dit uit in de les--&gt;
     &amp;nbsp;&lt;li&gt;&lt;a href="opdracht3t02m03.html"&gt;Borders&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a href="opdracht3t02m04.html"&gt;Classes&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a href="opdracht1t02m06.html"&gt;Floats&lt;/a&gt;&lt;/li&gt;
     &lt;li&gt;&lt;a href="opdracht3t02m06.html"&gt;Z-index&lt;/a&gt;&lt;/li&gt;
     &lt;/ul&gt;
     &lt;/li&gt;
     &lt;/ul&gt;
    &lt;/ul&gt;
    &lt;/nav&gt;
    &lt;main&gt;
    &lt;h1&gt;Tables&lt;/h1&gt;
    &lt;table&gt;
     &lt;tr&gt;
      &lt;th&gt;Voornaam&lt;/th&gt;
      &lt;th&gt;Achternaam&lt;/th&gt; 
      &lt;th&gt;Leeftijd&lt;/th&gt;
      &lt;th&gt;Woonplaats&lt;/th&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
      &lt;div class="firstname"&gt;&lt;script&gt;readJSON(persons);&lt;/script&gt; &lt;/div&gt;
      &lt;td class="firstname"&gt;&lt;/td&gt; 
      &lt;td class="firstname"&gt;&lt;/td&gt;
      &lt;td class="firstname"&gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
      &lt;td&gt;&lt;/td&gt;
      &lt;td&gt;&lt;/td&gt; 
      &lt;td&gt;&lt;/td&gt;
      &lt;td&gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
      &lt;td&gt;&lt;/td&gt;
      &lt;td&gt;&lt;/td&gt; 
      &lt;td&gt;&lt;/td&gt;
      &lt;td&gt;&lt;/td&gt;
     &lt;/tr&gt;
     &lt;tr&gt;
      &lt;td&gt;&lt;/td&gt;
      &lt;td&gt;&lt;/td&gt; 
      &lt;td&gt;&lt;/td&gt;
      &lt;td&gt;&lt;/td&gt;
     &lt;/tr&gt;
    &lt;/table&gt;
    &lt;/main&gt;
    &lt;footer&gt;
     &lt;span&gt; Gerard Van De Weijer 2017™&lt;/span&gt;
    &lt;/footer&gt;
   &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <hr>
  
  <p>.js file</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var persons = [
   {"firstname":"Nel", "lastname":"De Beer", "age":9, "location":"Weert"},
   {"firstname":"Bob", "lastname":"Janssen", "age":33, "location":"Eindhoven"},
   {"firstname":"Beatrix", "lastname":"Peperkamp", "age":76, "location":"Nijmegen"}
  ];</code></pre>
  </div>
  </div>
  </p>
  
  <hr>
  
  <p>i hope someone can help me i think im forgetting to declare that it has to be put in that table or maybe make that function into a var i hope you guys can clear this up thanks in advance</p>
  
  <p>with regards GPM</p>