How do I make the variable balance private, and at the same time keep the value 100.00 in the textfield?
HTML-textfield:
<span type="text" id="txtMyAccountBalance"> </span>
Here is the function:
function TAccount()
{
this.balance = 0.0;
this.printOut = function () {
txtMyAccountBalance.innerText = this.balance.toFixed(2);
}
}
var currentAccount = new TAccount ();
currentAccount.balance = 100.0;
This works quite good, and the textfield shows 100.00 as the balance. How do I make the variable balance private? I think I have to use var instead of this, but how?