News for hackers. Stuff that matters.
Re:Black Box Driven Development in JavaScript by protonfish on Wednesday August 27, 2014 @10:47AM (#8232387)
Assigning a variable as a pointer to an anonymous function:

    var Box = function(a, b) {};
as opposed to the simpler:

    function Box(a, b) {}
makes no sense. It is more verbose for zero benefit and makes all functions anonymous so you will never see that it is the Box function being called in your debuggers and profilers. If you want to enforce functions being declared before they are called, use JSLint (which you should be doing anyway.)
Re:Black Box Driven Development in JavaScript by dkyc on Wednesday August 27, 2014 @10:55AM (#8232430)
A lot of people use notation #1 to do namespacing by using objects, eg

  var MyProject = {};
  MyProject.func = function() {}
If you ever want to assign a function to an object, you might as well do it with global-scope functions. Most debuggers/profilers I am aware of can handle this notation well. If they don't, there is still the possibility of doing

  var Box = function Box (a, b) {}
The function does not have to be anonymous!
Re:Black Box Driven Development in JavaScript by ShellfishMeme on Wednesday August 27, 2014 @03:27PM (#8234222)
+1 for the named function expression. I really don't like pure function statements because of hoisting. You often end up seeing functions being used before they're defined which can lead to confusing bugs and hurts readability. I also like that `var Box = function Box (a, b) {}` directly shows people who are new to JS that function declarations are nothing else than just assigning a function to a variable.
Re:Black Box Driven Development in JavaScript by nawitus on Wednesday August 27, 2014 @11:07AM (#8232497)
I prefer:

  var Box = (a, b) => {};
I guess I just think that the more verbose form is more readable.
Re:Black Box Driven Development in JavaScript by krasimir-tsonev on Wednesday August 27, 2014 @11:44AM (#8232698)
I feel that "var Box = function(a, b) {};" is more readable (or at least for me)