What is the difference between these two ways to create an element?
<pre><code>var a = document.createElement('div');

a.id = "myDiv";
</code></pre>

<p>and</p>

<pre><code>var a = document.createElement('div').id = "myDiv";
</code></pre>

<p>What is the difference between them such that the first one works and the second one doesn't?</p>
