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
innerText
instead oftextContent
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>