html space characters

PHOTO EMBED

Tue Jan 10 2023 01:07:37 GMT+0000 (Coordinated Universal Time)

Saved by @chelobotix #htmlspace characters

Escaping HTML characters in a string means replacing the:
1.less than symbol (<) with &lt;
2.greater than symbol (>) with &gt;
3.double quotes (") with &quot;
4.single quote (') with &#39;
5.ampersand (&) with &amp;
 ------------------------------
function escape(htmlStr) {
   return htmlStr.replace(/&/g, "&amp;")
         .replace(/</g, "&lt;")
         .replace(/>/g, "&gt;")
         .replace(/"/g, "&quot;")
         .replace(/'/g, "&#39;");        

}

console.log(escape("<script>alert('hi')</script>"));
content_copyCOPY