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);
}
}