Editing a task in a checklist in JavaScript

Let's now implement editing. To do this, attach double click to span with text:

let task = document.createElement('span'); task.classList.add('task'); task.textContent = this.value; task.addEventListener('dblclick', function() { // here will be the code that implements editing }); li.appendChild(task);

By double clicking on the specified span we must create an input in it with the text of this span. Then, after pressing the Enter key in this input, we must write the text of this input back to our span, and remove the input itself.

Add the missing part of the code to solve the described problem.

enru