Update unescapeHTML.md

This commit is contained in:
atomiks
2017-12-30 00:13:15 +11:00
committed by GitHub
parent 3c5d387a21
commit dcc9b508b3

View File

@ -5,7 +5,7 @@ Unescapes escaped HTML characters.
Use `String.replace()` with a regex that matches the characters that need to be escaped, using a callback function to replace each escaped character instance with its associated unescaped character using a dictionary (object).
```js
const unescapeHTML = str => str.replace(/[&<>'"]/g, tag => ({
const unescapeHTML = str => str.replace(/&amp;|&lt;|&gt;|&#39;|&quot;/g, tag => ({
'&amp;': '&',
'&lt;': '<',
'&gt;': '>',