The following syntax is present in a .js file.
var fun1 = function(fun1_parameter1){
return{
fun2 : function(){
alert("xxx");
}
}
}
I am not getting this at all. This js file uses namespaces also. Help me understanding this.
What that code does is define a single variable named fun1.
The value is an anonymous function with one parameter.
Calling the function would return an anonymous object with a .fun2 property, which points to another anonymous function.
Calling that function would trigger the alert:
fun1(0).fun2(); // triggers alert("xxx")
fun1().fun2();