title: how to createElement with an id in one line
body: <p>i know that i can create an element such as:</p>
  
  <pre><code>var foo = document.createElement('div');
  </code></pre>
  
  <p>and to set the div id i would do as such:</p>
  
  <pre><code>foo.setAttribute('id', 'divName');
  </code></pre>
  
  <p>and if you google long enough you will find someone doing code such as here</p>
  
  <pre><code>var google = createElement("a",{"href":"http://google.com"},"google"),
      youtube = createElement("a",{"href":"http://youtube.com"},"youtube"),
      facebook = createElement("a",{"href":"http://facebook.com"},"facebook"),
      links_conteiner = createElement("div",{"id":"links"},[google,youtube,facebook]);
  </code></pre>
  
  <p>which would equal out to:</p>
  
  <pre><code>var foo = document.createElement('div', {'id':'divName);
  </code></pre>
  
  <p>yet when i run the above code the <code>id</code> or <code>divName</code> is not added and instead an empty div is created. so i am curious what i am doing wrong, and if it is even possible to both create and set the div name for an element using <code>.createElement</code> only?</p>