title: Convert special characters to HTML in JavaScript
body: <p>How can I convert special characters to HTML in JavaScript?</p>
  <p>Example:</p>
  <ul>
  <li><code>&amp;</code> (ampersand) becomes <code>&amp;amp</code>.</li>
  <li><code>&quot;</code> (double quote) becomes <code>&amp;quot</code> when <code>ENT_NOQUOTES</code> is not set.</li>
  <li><code>'</code> (single quote) becomes <code>&amp;#039</code> only when <code>ENT_QUOTES</code> is set.</li>
  <li><code>&lt;</code> (less than) becomes <code>&amp;lt</code>.</li>
  <li><code>&gt;</code> (greater than) becomes <code>&amp;gt</code>.</li>
  </ul>