I want to create a function where I get a number from a prompt and then create a loop where the number I got is the number of time the alert() executes.
I tried like this :
function game() {
var i = prompt("Choose a number");
for(i; i === 0; i--) {
alert("ALERT");
}
}
game();
But after I get the prompt(), nothing happens
Your for-loop condition is wrong. Should be i>0, not i===0.