<script>
        //Function to add IDs to each heading 2
        function addIdsToHeadings() {
            const headings = document.getElementsByTagName('h2');

            for (let i = 0; i < headings.length; i++) {
                const heading = headings[i];
                const headingText = heading.textContent;
                const headingId = `section-${i + 1}`;

                // Create an anchor link and insert it before the heading
                const anchorLink = document.createElement('a');
                anchorLink.href = `#${headingId}`;
                anchorLink.textContent = headingText;
                heading.textContent = ''; // Clear the heading text
                heading.appendChild(anchorLink);

                heading.id = headingId; // Set the heading's ID
            }
            console.log(headings);
        };
        window.onload = function() {
            addIdsToHeadings();
            
        };
</script>