1var myButton = document.getElementById("my-button");
2//Getting the button with "my-button" as id.
3var myOutput = document.getElementById("my-output");
4//Getting the id for the tag where you want to output your number
5var startNumber = 0;
6
7/*Creating a function where it adds 1 to the startNumber variable
8for every time you click on myButton.*/
9function addToNumber(){
10 //Using template literal here.
11 myOutput.innerHTML = `The current number is: ${1+startNumber++}`;
12 /*Sets the startNumber to 1+ startNumber++.
13 This makes it look like it starts to count from 1 and not 0
14 the first time you click the the button.*/
15}
16myButton.onclick = addToNumber;