2

In some projects I can see, that the functions wich are object methods get names after the function constructor - I can not see why, can any one explain?

Example: named

someObj.prototype = {
        load: function someObj_load(file) {

vs unnamed

someObj.prototype = {
        load: function(file) {

I can not see any advantage in the above.

Paflow
  • 2,030
  • 3
  • 30
  • 50

1 Answers1

4

So you can see the name of the function name instead of Anonymous function in stack traces. I think some browsers will pick up the name of the variable/attribute you've assigned it to. Some don't.

Patrick Denny
  • 290
  • 1
  • 5