When to use anonymous JavaScript functions?
<p>I'm trying to understand when to use anonymous JavaScript functions.</p>

<p>State differences between the functions? Explain when you would use each.</p>

<pre><code>var test1 = function(){
    $("&lt;div /&gt;").html("test1").appendTo(body)
};

function test2() {
    $("&lt;div /&gt;").html("test2").appendTo(body)
}
</code></pre>

<p>I think the answer is that one uses anonymous function and the other doesn't to replace an empty div element.  Does that seem right?</p>
