Appending a node

Report a typo

You have the following to-do list:

<ul>
  <li>Learn JavaScript</li>
</ul>

A new list item is created in the code below:

let list = document.querySelector("ul");
let newTask = document.createElement("li");
newTask.textContent = "Learn HTML";

Add the new task as the first child of the list element. Use the existing variables.

Enter a short text
___

Create a free account to access the full topic