Hi! I don´t understand why my code isn´t working? What is strange to me is that, if I console.log()
everything, it does work.
Your code so far
function convertHTML(str) {
if(str.indexOf("&") >= 0){
str.replace("&","&")
}
if(str.indexOf("<") >= 0){
str.replace("<","<")
}
if(str.indexOf(">") >= 0){
str.replace(">",">")
}
if(str.indexOf('"') >= 0){
str.replace('"',""")
}
console.log(str.indexOf("&"))
console.log(str.indexOf("&") >= 0)
console.log(str.replace("&","&"))
return str
}
console.log(convertHTML("Dolce & Gabbana"));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36
Challenge: Intermediate Algorithm Scripting - Convert HTML Entities
Link to the challenge: