Thank you for sharing this! ๐ And yes there's no particular reason here to use innerText instead of textContent as both will work just fine. However, it's important to know the difference:
textContent gets the content of all elements, including and <style> elements. In contrast, innerText only shows โhuman-readableโ elements. textContent returns every element in the node. In contrast, innerText is aware of styling and wonโt return the text of โhiddenโ elements.</p>
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thank you for sharing this! ๐ And yes there's no particular reason here to use
innerTextinstead oftextContentas both will work just fine. However, it's important to know the difference:textContent gets the content of all elements, including and <style> elements. In contrast, innerText only shows โhuman-readableโ elements. textContent returns every element in the node. In contrast, innerText is aware of styling and wonโt return the text of โhiddenโ elements.</p>