Why use variables when adding text to the DOM?
<p>I am pretty new to web dev and I have been doing some JavaScript exercises I found on line. One of them asks to prompt the user for a first and last name and add these names to the document.</p>

<p>In researching this I found code that used a lot of variables. My solution was this:</p>

<pre><code>var el = document.getElementById("welcome");
var txt = fullName;
var node = document.createTextNode(txt);
el.appendChild(node);
    };

greet()
</code></pre>

<p>I played around a bit, and found that this worked:</p>

<pre><code>document.getElementById("welcome").appendChild(document.createTextNode(fullName));
</code></pre>

<p>You can see my original solution at <a href="http://jsfiddle.net/mPscp/" rel="nofollow">jsFiddle</a>. I also added the instructions to the HTML.</p>

<p>My question is why do most tuts suggest putting in the variables at all? Is it best practice? Why?</p>

<p>Oh, and if you go there, can someone tell me why my ordered list came out with no numbers? Does jsFiddle use a reset on their CSS?</p>

<p>Note: I'm not sure I needed to put it in a function, but right  now, putting everything in a box helps me keep organized.</p>

<p>Thanks for any help
Dave</p>
