V
Vipul Kapadia
Hi All,
Am pasting below a javascript which I need to comprehend. Please
help..
var foo = function()
{
return
{
func1:function(url)
{
... some javascript code ..
},
func2:function()
{
... some javascript code ...
},
func3:function()
{
.... some javascript code ...
}
};
}();
This is then called using:
foo.func2();
foo.func3();
It seems that it is creating some kind of class/object and then
calling the functions defined (nested ?), but I cant figure out where/
how these functions are getting initialized or what is exactly
happening.
It would be nice to get a explanation regarding this.
Thanks
Vipul Kapadia
Am pasting below a javascript which I need to comprehend. Please
help..
var foo = function()
{
return
{
func1:function(url)
{
... some javascript code ..
},
func2:function()
{
... some javascript code ...
},
func3:function()
{
.... some javascript code ...
}
};
}();
This is then called using:
foo.func2();
foo.func3();
It seems that it is creating some kind of class/object and then
calling the functions defined (nested ?), but I cant figure out where/
how these functions are getting initialized or what is exactly
happening.
It would be nice to get a explanation regarding this.
Thanks
Vipul Kapadia