1function deleteChild() {
2 let e = document.querySelector("ul");
3
4 //e.firstElementChild can be used.
5 let child = e.lastElementChild;
6 while (child) {
7 e.removeChild(child);
8 child = e.lastElementChild;
9 }
10 }
11 let btn = document.getElementById(
12 "btn").onclick = function() {
13 deleteChild();
14 }