I have a question about adding/removing in HTML.
I have a list, with, say, 3 li. to add one more li I can use either(coach's ) :
const myList = document.querySelector("ul");
const myItem = document.createElement("li");
myList.appendChild(myItem);
or, what I liked more for it's shorten way(tutorial's):
myList.innerHTML += "<li></li>";
but, then, when I wish to remove this added li,(coach's - myItem.remove();) and trying to go the same way as tutorial's, something like:
myList.querySelector(li:last-child).innerHTML -= "<li></li>";
it is not working. apparently it is fundamentally wrong, but nevertheless is there a solution with innerHTML?
appreciate any answer.