Your colleague started writing handlers.
But the handler for the .chapter element does not fire when clicking on nested .section elements.
But should. Help your colleague figure it out.
You just need to fix one line in the script, don’t change anything else.

This task is part of the Full-Stack JavaScript Course
If you have any issues with it, you can ask for community help below the post
Feel free to help others if you’ve already solved the task


    <title>Table of contents</title>
    <h2>Very interesting book</h2>
      <li class="chapter" id="chapter1">
        Chapter 1: Introduction
          <li class="section" id="section1-chapter1">
            Section 1: Background
          <li class="section" id="section2-chapter1">
            Section 2: Methods
      <li class="chapter" id="chapter2">
        Chapter 2: Main
          <li class="section"  id="section1-chapter2">
            Section 1: Results
          <li class="section"  id="section2-chapter2">
            Section 2: Discussion
      const chapters = document.querySelectorAll('.chapter');
      const sections = document.querySelectorAll('.section');

      for (let chapter of chapters) {
        chapter.addEventListener('click', e => {
          console.log('Chapter details: ' +;

      for (let section of sections) {
        section.addEventListener('click', e => {
          console.log('Section details: ' +;