how to create a button which increments a number in javascript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script defer src="script.js"></script>
<title>Document</title>
</head>
<body>
<div id="increment-num">0</div>
<button id="increment-btn">Increment by 1</button>
<script>
var incrementNum = document.getElementById('increment-num');
var incrementBtn = document.getElementById('increment-btn');
incrementBtn.addEventListener("click", () => {
incrementNum.innerHTML++;
});
</script>
</body>
</html>