<!DOCTYPE html>
<html lang="en">
  <meta charset="UTF-8">
  <title>Change Paragraph Color</title>
    #randomColorButton {
      padding: 10px 20px;
      font-size: 16px;
      cursor: pointer;
  <p id="changeColorParagraph">Click the button below to change the color of this paragraph!</p>
  <button id="randomColorButton">Change Color</button>


    document.getElementById('randomColorButton').addEventListener('click', function() {
      let paragraph = document.getElementById('changeColorParagraph');
      let randomColor = getRandomColor(); = randomColor;

    function getRandomColor() {
      let letters = '0123456789ABCDEF';
      let color = '#';
      for (let i = 0; i < 6; i++) {
        color += letters[Math.floor(Math.random() * 16)];
      return color;

Try to answer about this code:

What does the JavaScript function getRandomColor() do?

Changes the font size of the paragraph
Generates a random color for the paragraph text

Adds a border around the paragraph
Hides the paragraph element

Which HTML element is used to change the color of the paragraph text?



What does the CSS rule #randomColorButton specify?

Styles applied to the paragraph
Styles applied to the button element

Styles applied to the body of the HTML document
Styles applied to the entire webpage

How is the click event handled for changing the paragraph color?

Using onmouseover attribute in HTML
Using addEventListener() in JavaScript

Using onclick attribute in HTML
Using onchange attribute in HTML