I started learning js recently and I have a question- i.e in this code-
<html>
<body>
<button type="submit" id='1'>Click me!</button>
</body>
<script>
function fun() {
let x = Math.Random();
}
var x = document.getElementById('1');
x.addEventListener("click", fun);
</script>
</html>
Do I get a different number every time I press the button? if not, why? Don't I call the function every time I press the button, and thus I generate a different number?
addEventListener. Also, you're never using that random number.funas callback notfunction