What's the right way to decode a string that has special HTML entities in it?

@smrity.maharishsarin I have used the same method you mentioned, and while it looks a bit meh but it’s reliable.

Another clean vanilla JS way is using DOMParser, especially if you’re already dealing with markup:

function decodeHtml(html) {
  return new DOMParser().parseFromString(html, "text/html").documentElement.textContent;
}

Great for quick javascript html decode needs and works in most modern browsers.