I have this code to try and make an alert pop up on the web page that says "your number is" + "(1-25)". Nothing happens when I press the button. Does math.random only produce a number to the console or why does this not work. Here is my code.
function rGen () {
let rNum = (Math.floor(Math.random() * 25))
alert(rNum + "is your number")
}
let button1 = document.getElementById('button1');
button1.addEventListener('click' rGen)
Aucun commentaire:
Enregistrer un commentaire