Looking for help with the Ping Pong Test. Whenever I click Start and enter a number, it just keeps adding to the list. How can I make it reset the list after each input?
$(document).ready(function() {
$("#Start").click(function() {
var number = parseInt(prompt("Please pick an integer to play."));
for(index = 1; index <= number; index +=1) {
if (index % 15 === 0) {
$('#list').append("<li>" + "ping-pong" + "</li>");
} else if (index % 3 === 0) {
$("#list").append("<li>" + "ping" + "</li>");
} else if (index % 5 === 0 ) {
$("#list").append("<li>" + "pong" + "</li>");
} else {
$("#list").append("<li>" + index + "</li>");
}
}
});
});