JSFiddle - React, Tailwind, and code Playground

HTML

<body>
    <button id="add">add</button>
    <br>
    <br>
    <button id="startsequence">total</button>
</body>

JavaScript

var times = [];

var total = 0;
for (var i = 0; i < times.length; i++) {
    total += +times[i];
}

document.getElementById("add").onclick = function () {
    times.push(1);
};

document.getElementById("startsequence").onclick = function () {
    alert(times + " adds up to " + total);
};