Sunday, August 31, 2008

function call in javascript

I was studying russkey.mozdev.org source code to learn how to write Firefox extension.

Found this style of function call in javascript.


var collection = {

hello : function() {
document.write("Hello World!");
},

understand : function() {
document.write("<br/>Understand!");
},

bye : function() {
document.write("<br/>bye!");
}

};


var m = new collection.hello();
var n = new collection.understand();
var o = new collection.bye();



The output will

Hello World!
Understand!
bye!

No comments: