A tiny web snippet with a quirky bug hiding inside.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Spot the Bug - quirky timer</title>
<style>
.box { width: 200px; height: 100px; background: #f0f0f0; border: 1px solid #ccc; display: flex; align-items: center; justify-content: center; }
</style>
</head>
<body>
<div class="box" id="box">0</div>
<button id="start">Start</button>
<script>
// The goal: inner counter should update every second when started
let count = 0;
const box = document.getElementById('box');
document.getElementById('start').addEventListener('click', function() {
setInterval(function() {
count++;
box.textContent = count;
}, 1000);
});
</script>
</body>
</html>
Reply with what is broken and how you would fix it.