take the code below:
contentsDiv.innerHTML = container.outerHTML;
if(contentsDiv.firstChild === container) console.log('true');
in this code, contentsDiv is a div created in my html file while container is a div with class='container' created with JavaScript. Then i insert container into contentsDiv. But when i check to see if the contentsDiv's firstChild is equal to container (which it is in the DOM) it doesnt console.log('true')
I tried
console.log(typeof(contentsDiv.firstChild))
console.log(typeof(container))
both returned to be an object but somehow they don't resolve to be equal when i use '==' or '==='