Find the output

Report a typo

What will be the output of the following code?

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>What's the output?</title>
  </head>
  <style>
    div {
      display: flex;
      justify-content: center;
      align-items: center;
    }
    .first-div {
      border: 1px solid blue;
      height: 200px;
      width: 200px;
      padding: 10px;
      text-align: center;
    }

    .second-div {
      border: 1px solid red;
      height: 150px;
      width: 150px;
      padding: 20px;
      text-align: center;
    }
  </style>
  <body>
    <div class="first-div" id="grandparent">
      First div
      <div class="second-div" id="parent">
        Second div
        <button class="button" id="child">Button</button>
      </div>
    </div>
    <script>
      const grandParent = document.getElementById("grandparent");
      const parent = document.getElementById("parent");
      const child = document.getElementById("child");

      grandParent.addEventListener("click", (event) => {
        console.log("Reached GrandParent");
        event.stopPropagation();
      });
      parent.addEventListener("click", (event) => {
        console.log("Reached Parent");
      });
      child.addEventListener("click", (event) => {
        console.log("Reached Child");
      });

      document.addEventListener("click", (event) => {
        console.log("Document");
      });
    </script>
  </body>
</html>
Select one option from the list
___

Create a free account to access the full topic