This is not how `setInterval()` works. You need to pass the function directly, like this: setInterval(function() { if (copper < max) { copper++; document.getElementId('GC').innerHTML = copper; } }, 1000);