Create a generic function that outputs one line of the countdown (ten, nine, eight, seven etc.) on the web page, followed by an alert, and receives the data to output as an input parameter. Use that function to output each line of the countdown, and an alert.
I need to output the countdown to the browser window and an alert is only being used to signal when to output the next line.
I need to use a loop. I also can't use an array.
This is what I have so far.
But I can’t figure out how to define the function that has an input parameter that contains the line to output.
for (var count=10; count >= 1; count--) {
window.alert("Click Okay!");
document.write(count+"<br />")
}
{
window.alert("Click Okay!")
document.write("Ignition Start<br />")
window.alert("Click Okay!")
document.write("Liftoff<br />")
window.alert("Click Okay!")
document.write("We Have Liftoff!<br />")
}