Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Javascript convert html entity to string

const htmlEntities = {
    "&": "&",
    "<": "&lt;",
    ">": "&gt;",
    '"': "&quot;",
    "'": "&apos;"
  };
return str.replace(/([&<>"'])/g, match => htmlEntities[match]);
}
 
PREVIOUS NEXT
Tagged: #Javascript #convert #html #entity #string
ADD COMMENT
Topic
Name
1+5 =