News for hackers. Stuff that matters.
Re:Javascript patterns by jbnicolai on Wednesday January 01, 2014 @08:20PM (#6997677)
Not just the name, the entire function declaration is hoisted. That's the difference between:

    function () {
      ...
      var a = function () {};
    }
which gets hoisted to:

    function () {
      var a;
      ...
      a = function () {};
    }
and:

    function () {
      ...
      function a () { };
    }
Which gets hoisted in it's entirety to:

    function () {
      function a () { };
      ...
    }
Which will cause difference behaviour between the two when calling a in the ... section, working in the latter case but undefined in the first.

I don't think the grandparent was unclear about this in his post though.

Re:Javascript patterns by Zecc on Thursday January 02, 2014 @04:21AM (#6998840)
And as a bonus, the latter gets its name set. Of course you could also name it in the function expression, but then you'd just be repeating yourself.