276 B
276 B
importance: 5
createTextNode vs innerHTML vs textContent
We have an empty DOM element elem
and a string text
.
Which of these 3 commands do exactly the same?
elem.append(document.createTextNode(text))
elem.innerHTML = text
elem.textContent = text