age = age + 1
HTML
<button id="moneyButton">Increase money by 1</button> <p id="moneyParagraph">Money: $0</p>
JavaScript
let moneyButton = document.getElementById(`moneyButton`) let moneyParagraph = document.getElementById(`moneyParagraph`) let money = 0 moneyButton.addEventListener(`click`, increaseMoney) function increaseMoney() { // your code will appear here moneyParagraph.innerHTML = `Money: $${money}` }
Your code
Test your code
Money: $0
HTML
<button id="scoreButton">Increase score by 2</button> <p id="scoreParagraph">Score: 0</p>
JavaScript
let scoreButton = document.getElementById(`scoreButton`) let scoreParagraph = document.getElementById(`scoreParagraph`) let score = 0 scoreButton.addEventListener(`click`, increaseScore) function increaseScore() { // your code will appear here scoreParagraph.innerHTML = `Score: ${score}` }
Your code
Test your code
Score: 0
HTML
<button id="pointsButton">Decrease points by 1</button> <p id="pointsParagraph">Points: 0</p>
JavaScript
let pointsButton = document.getElementById(`pointsButton`) let pointsParagraph = document.getElementById(`pointsParagraph`) let points = 0 pointsButton.addEventListener(`click`, decreasePoints) function decreasePoints() { // your code will appear here pointsParagraph.innerHTML = `Points: ${points}` }
Your code
Test your code
Points: 0
HTML
<button id="increaseWidthButton">Increase width by 10</button>
JavaScript
let increaseWidthButton = document.getElementById(`increaseWidthButton`) let width = 200 increaseWidthButton.addEventListener(`click`, increaseWidth) function increaseWidth() { // your code will appear here increaseWidthButton.style.width = `${width}px` }
Your code
Test your code
HTML
<button id="decreaseOpacityButton">Decrease opacity by 10</button>
JavaScript
let decreaseOpacityButton = document.getElementById(`decreaseOpacityButton`) let opacity = 100 decreaseOpacityButton.addEventListener(`click`, decreaseOpacity) function decreaseOpacity() { // your code will appear here decreaseOpacityButton.style.opacity = `${opacity}%` }
Your code
Test your code
HTML
<button id="numberButton">Double the number</button> <p id="numberParagraph">Number: 1</p>
JavaScript
let numberButton = document.getElementById(`numberButton`) let numberParagraph = document.getElementById(`numberParagraph`) let number = 1 numberButton.addEventListener(`click`, doubleNumber) function doubleNumber() { // your code will appear here numberParagraph.innerHTML = `Number: ${number}` }
Your code
Test your code
Number: 1