The function definition.

The function definition.

From  http://learn.jquery.com/javascript-101/scope/

I do not understand why the first one is better than the second?

  1. // Functions can see changes in variable values after the function is defined
  2. var myFunction = function() {
  3.     var foo = "hello";
  4.     var myFn = function() {
  5.         console.log( foo );
  6.     };
  7.     foo = "world";
  8.     return myFn;
  9. };
  10.  
  11. var f = myFunction();
  12. f(); // "world"

  1. var myFunction1 = function() {
  2.     var foo = "hello1";
  3.     var myFn = function() {
  4.         console.log( foo );
  5.     };
  6.     foo = "world1";
  7.     return myFn();
  8. };
  9.  
  10. myFunction1();




And how this is more readable 
  1. var foo = function() {
  2. /* do something */
  3. }
than this?
  1.       
    function foo() {
    /* do something */
    }