What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-10-24 07:21:12
javascript escape html string
function escapeHtml(str) { return str.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;"); } Add solution -
Javascript 2021-10-22 11:30:04
javascript remove period from end of string
// Single dot: if (str[str.length-1] === ".") str = str.slice(0,-1); // Multiple dots: while (str[str.length-1] === ".") str = str.slice(0,-1); // Single dot, regex: str = str.replace(/\.$/, ""); // Multiple dots, reg... Add solution
Best helpers
Ranking is empty