This is part of a series of exercises I have been doing and it's the only one I haven't been able to complete (I'm a Javascript beginner). The exercise says to "Create an input, and a button, so that everytime a value is entered the total value is stored in a variable. Create another button, that when pressed shows the accumulated total."
I have tried this:
JavaScript:
function ex15Save(ex15Num){
let num1 = document.getElementById("ex15Num");
var ex15Num = num1;
let ex15Storage;
ex15Storage += ex15Num;
}
HTML:
<label>Number to store
<input id="ex15Num" type="number"> </label>
<button onclick="ex15Save()">Save Total</button>
<button onclick="ex15Show()">Show total</button>
<p id="ex15Total"></p>
I know the code is not even close to being finished but it has gotten to a point where my brain can't comprehend how to store the sum of the values without overwriting the value of a variable.