Warm-Up: Counting
In this activity, build a simple counting program that displays numbers sequentially! Ah ah ah!
Start by remixing this starter project.
The project has some basic setup: an HTML <button>
that calls a function named count
when it is clicked. The function is defined as follows:
function count() {
alert("Here we go!");
alert(1);
alert(2);
alert(3);
alert(4);
}
Your goal is to make the count
function display numbers all the way up to 100
! Open up the script.js file, and update the body of the count
function so that it has more alert
statements, each counting up one more.
Challenge
For an extra challenge, update the count
function so that instead of using alert
, it updates some of the actual HTML on the page. Try to make it so that every time the "Count" button is clicked, it adds another number to the page.