title: Javascript stylistics - Professional looking code
body: <p>I keep reading JS books that contain stuff like:</p>
  
  <pre><code>function onSuccess(entries) {
      document.getElementById("loading").innerHTML="";
      var ul = document.getElementById("file-listing");
      for(var index=0;index&lt;entries.length;index++) {
          var li = document.createElement('li');
          li.innerHTML = entries[index].name;
          ul.appendChild(li);
      }
  }
  </code></pre>
  
  <p>However, I read on multiple sites that it's faster and cleaner to create the whole list in a html = "", add the ul and li elements and then add the block, append it all in one call... so I am wondering if I should follow the style that I find in many js books or what I read on performance blogs? I am mostly concerned that people reading my code will find it amateurish, if I use the previous code block. Also I have meet a few people that are like, wow all you use is jQuery... instead of using DOM calls like <code>document.getElementById()</code>, etc...</p>