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