Tell us what’s happening:
Help me, please!!!
My object is created
let entitiesHTML = {
'&':'&',
'<':'<',
'>':'>',
'"':'"',
'\'':'''
};
But it became {&: "&​amp;", <: "&​lt;", >: ">", ": """, ': "'"}
as the following picture
Who can explain to me, please?
Your code so far
function convertHTML(str) {
// :)
let entitiesHTML = {
'&':'&',
'<':'<',
'>':'>',
'"':'"',
'\'':'''
};
return str.split('').map((entity) => entitiesHTML[entity] || entity).join('');
}
convertHTML("Dolce & Gabbana");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) coc_coc_browser/80.0.180 Chrome/74.0.3729.180 Safari/537.36
.
Link to the challenge: