I am trying to set up an if/else if statement within a loop that is started by a prompt. As I have it now, nothing happens after inputting a number into the prompt and hitting OK. I am just starting out so please be gentle. Thanks!
$(function() {
var number = parseInt(prompt("Let me see a number:"));
for(var i = 0; i <= number; i++) {
if ( digit %15 == 0) {
return "Ping-Pong";
}
else if (digit %5 == 0) {
return "Pong";
}
else if (digit %3 == 0) {
return "Ping";
}
else {
return i;
}
};
});
Aucun commentaire:
Enregistrer un commentaire