0

I want to translate an input from an API like this

    <p>Communication that doesn&#8217;t take a chance doesn&#8217;t stand a chance.</p>

into something like this

"Communication that doesn’t take a chance doesn’t stand a chance."

I understand that html could translate this but I don't know how to translate this directly for use in javascript

Tienanh Nguyen
  • 211
  • 4
  • 9

1 Answers1

0

Insert it into an element as HTML, and read it back out as text.

var elt = document.createElement('div');
elt.innerHTML = apiResponse;
alert(elt.textContent);