PDA

View Full Version : Invoking methods through methods


snowtown
01-05-2003, 12:33 PM
Hi!

Is it possible to invoke methods through another methods like this:

obj.test("hello").test2();

If so, can You please explain how?

Thanks

jkd
01-05-2003, 06:14 PM
var obj = {
test: function(str) {
return { test2: function() { alert('Hello ' + str + '!') } };
}
};


The method just needs to return an object with more methods...

snowtown
01-05-2003, 07:35 PM
Thank you.

:)