Convert HTML Entities
function convertHTML(str) {
let entities = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
}
return str.replace(/([&<>"'])/g, match => {
return entities[match]
})
}
convertHTML("Dolce & Gabbana");