I am trying to add ® sign to my string. How do I get it to recognize the @reg; as a symbol in my string?
"MyCompany® Official Site"
CodePudding user response:
You'll need to use a DOMParser
to decode the entity by parsing it as HTML:
const res = new DOMParser().parseFromString(`MyCompany® Official Site`, 'text/html').body.textContent
console.log(res)
<iframe name="sif1" sandbox="allow-forms allow-modals allow-scripts" frameborder="0"></iframe>