what is the difference between the below syntaxes?
<pre><code>1. $(function () {
       function foo() { return true; }
       log(bar());                        // getting error
       var bar = function() { return true; };   
  });

2. $(function () {
       function foo() { return true; }
       var bar = function() { return true; };
       log(bar());                        // Working   
  });
</code></pre>

<p>my confusion here is what is the difference between the below two declarations and which one is useful?</p>

<pre><code>var bar = function() { return true; };

function bar(){ return true; };
</code></pre>
