My function looks like this:
flag: boolean = false;
some_function(){
var foo = some_num_value;
var bar = foo; // Storing value in a separate variable
if(this.flag){
var total = bar + foo;
}
return total;
!this.flag;
}
This particular function is executed 2 or 3 times within a single instance. The value of var foo
changes with each iteration. I want to preserve the value of each var foo
so that I can add it to the new value of var foo
in the next iteration.
Any suggestions on how I can achieve this?