Sunday, 15 April 2012

JavaScript Duplicate function names when declaring a method -



JavaScript Duplicate function names when declaring a method -

this stupid question, hoping find out knows improve do, there difference between next function declarations within class?

somefunction: function (obj) {};

and

somefunction: function somefunction (obj) {};

setting name on anonymous function allows utilize name inside function.

for example:

var funcs = { somefunction: function somefunction(obj){ // can access 'somefunction' in here }, otherfunction: function(obj){ // cannot access 'otherfunction', // you'd need 'funcs.otherfunction' } };

javascript

No comments:

Post a Comment