title: Show JavaScript result with html
body: <p>I have this JavaScript code which shows open and close ports. I want to show the result of this javaScript code on html page exactly as it is written in console.log.</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  
   &lt;script type="text/javascript"&gt;        
   var net = require('net'); 
   var ipStart = 0;
   var ipEnd = 245; 
   var timeout = 2000;
  
   while (ipStart &lt;= ipEnd) {
   var count = ipStart;
      (function(count) {
      var hostOne = '192.168.0.' + count;
      var hostTwo = '192.168.1.' + count;
      var hostThree = '192.168.2.' + count;
  
      var socket = new net.Socket();
      socket.setTimeout(timeout, function() { socket.destroy(); });
      socket.connect(80, function() {
  
          console.log('IP Adress ' + hostOne + ' is on port 80 Open!');
          console.log('IP Adress ' + hostTwo + ' is on port 80 Open!');
          console.log('IP Adress ' + hostThree + ' is on port 80 Open!');
          });
  
          socket.on('error', function(e) {
  
          console.log('IP Adress ' + hostOne + ' is on port 80 Closed!');
          console.log('IP Adress ' + hostTwo + ' is on port 80 Closed!');
          console.log('IP Adress ' + hostThree + ' is on port 80 Closed!');
          });
      })(count);
  
      ipStart++;
   }
  
      &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is a part of the result on terminal when I only run js file of it:</p>
  
  <pre><code> IP Adress 192.168.0.244 is on port 80 Closed!
   IP Adress 192.168.1.244 is on port 80 Closed!
   IP Adress 192.168.2.244 is on port 80 Closed!
   IP Adress 192.168.0.245 is on port 80 Closed!
   IP Adress 192.168.1.245 is on port 80 Closed!
   IP Adress 192.168.2.245 is on port 80 Closed!
  </code></pre>
  
  <p>Can anybody help?</p>