As the title says, I have some code here that works:
const oaxaca = document.getElementById('oaxaca');
const textNode = document.createTextNode('sample');
oaxaca.replaceChild(textNode, oaxaca.childNodes[0]); // This works
Yet this does not:
const oaxaca = document.getElementById('oaxaca');
const textNode = document.createTextNode('sample');
oaxaca.childNodes[0] = textNode; // Does nothing
Could someone explain why this doesn't work, it seems intuitive that it would have the same effect but it does not alter childNodes[0] at all.