Exercise Set 4

Exercise 1 of 6

Watch the incrementing variable video. Increase the number when the button is clicked.


<button id="increaseNumberButton">Increase number</button>
<p id="numberParagraph">Number: 0</p>


var increaseNumberButton = document.getElementById("increaseNumberButton");
var numberParagraph = document.getElementById("numberParagraph");

var number = 0;

increaseNumberButton.addEventListener("click", increaseNumber);

function increaseNumber() {
    // your code will appear here
    numberParagraph.innerHTML = "Number: " + number;

You must be signed in to type your code.

Last topic Next exercise