I have the following class:
var myclass = (function(){
var b={};
b.method1 = function(){
console.log("method1");
};
b.method2 = function class2(){
console.log("method2");
};
return b;
}());
Is there any difference between these methods other than that method1
is anonymous functions assigned to method1 and method2
is a named function?
I usually use the method1 way but just discover method2 for method declaration.
And are there any advantages to use one over the other?