WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 Prototype, Joe, October 28, 2004
     Re:Prototype, Erik Arvidsson, October 28, 2004
         Re:Prototype, Joe, October 28, 2004

Subject: Prototype From: Joe Date: October 28, 2004

Is there any way to iterate through an objects methods and access them (if avalible, i.e function name and body). Look at the pseudo code below.

test = {
car : function () {
  return 'Have wheels.';

 spaghetti : function () {
  return 'Is eatable';

alert(test.car());  // alerts 'Have wheels';

How can I make a call that will return functionName and functionbody without actually defining the functionname...something like:

alert(test[0]);  // I want it to return 'car';

Thanx in advance,



Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.

View All Messages
Back to WebFX