Solution: Style with Code
Changes the text size randomly each time the button is clicked.
Explanation:
The element with ID
"randomSize"listens for a click event.When clicked, it generates a random number between 16 and 45 (using
Math.random()andMath.floor()).That number is turned into a font size value (like
"24px").The text inside the element with ID
"preview"updates to this new random font size.
Solution: Style with Code
Changes the text size randomly each time the button is clicked.
Explanation:
The element with ID
"randomSize"listens for a click event.When clicked, it generates a random number between 16 and 45 (using
Math.random()andMath.floor()).That number is turned into a font size value (like
"24px").The text inside the element with ID
"preview"updates to this new random font size.