What is the simplest way to do with array a kind of bank where I put a value in an array and show the same later. My problem is to modify the array , where the initial value would be 0 and hence as it is deposited the value will increase based on my logic there very simple.
var dinheiro = [];
var totalSaque;
function depositar() {
var deposito = document.getElementById("txt").value;
totalSaque = dinheiro + deposito;
document.getElementById("dep").innerHTML = "--valor depositado--";
}
function verConta() {
document.getElementById("ex").innerHTML = totalSaque;
document.getElementById("dep").innerHTML = "";
}
<!DOCTYPE html>
<html>
<head>
<title>banco</title>
</head>
<body>
<h1 style="float: left;">No Caixa:</h1><h1 id="ex" style="float: left;">0</h1>
</br></br></br></br></br>
<input id="txt" type="number">
<button onclick="depositar()">Depositar</button>
<button onclick="verConta()">ver Conta</button>
<p id="dep"></p>
</body>
</html>