It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Return value to method in class

Return value to method in class

Postby luz on Fri Nov 20, 2009 2:32 am

Hi...i'm still new at this js oo..what i would to do is return value from a one class method to the other..as you all can see below i have 2 simple class which is MyMath and MathResult ..the problem is how can i return the value of this.DoMath()which is this.total in MyMathto this.ShowMathResult in MathResult..thanking you all in advance for reviewing my post

Code: Select all
function MyMath(){
   this.StartMath = function(a,b,c){
      this.a = a;
      this.b = b;
      this.c = c;
      this.DoMath();   
   };
   this.DoMath() = function(){
      this.total = this.a +this. b - this.c;
      return this.total;
   };
   
}
function MathResult(){
   this.ShowMathResult = function(){
       alert(this.total);
   }
}
luz
 
Posts: 1
Joined: Fri Nov 20, 2009 2:12 am

Who is online

Users browsing this forum: psbot [Picsearch] and 8 guests