Why does the following code return NaN (Not a Number)? - and how to return the result of (balance) * (index) in number?
function ContaPoupanca(){
this.saldo = 0;
this.deposita = function(valor){
this.saldo += valor;
};
this.atualiza = function(indice){
this.saldo += this.saldo * this.indice;
};
};
var contaPoupanca = new ContaPoupanca();
contaPoupanca.deposita(1000);
console.log(contaPoupanca.saldo);
contaPoupanca.atualiza(0.05);
console.log(contaPoupanca.saldo);