const paragraph = document.createElement('p');
console.log(paragraph.textContent);
console.log(paragraph)
paragraph.textContent = "I'm a brand new paragraph.";
console.log(paragraph);
Above code is giving below output
we're logging paragraph element before assigning textContent then how can it have updated value although paragraph.textContent is empty string at that time.
I'm new to JS and learning DOM. Can someone explain what is this behavior?