The script needs to be improved.
The first thing to do is add the deleteParagraph function as a handler for the button click.
After the first activation of the function, this handler must be removed.
Modify an existing script.

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


<!DOCTYPE html>
    <p>Paragraph 1</p>
    <p>Paragraph 2</p>
    <button>Delete paragraph</button>
      const button = document.querySelector('button');
      function deleteParagraph() {
        const paragraphs = document.querySelectorAll('p');
        paragraphs[paragraphs.length - 1].remove();