innerText in javascript
In javascript we can add or retrieve string contents which are visible in a web page, using innerText property.
Syntax
element.innerText
Difference between innerHTML and innerText
InnerText is used when there is a need to add or retrieve plain text content, even if it is an HTML content it will be rendered as plain text.
Unlike innerText, innerHTML is used to encode or decode the HTML content.