Tell us what’s happening:
ik im in the last of the intermediate probs and difficulties WILL arise… but im also stumped here… a bit
Your code so far
function convertHTML(str) {
let apost = "<"
let quote = """
let more = ">"
let less = "<"
let amp = "&"
let charArr = str.split("")
//console.log(charArr)
for (let i = 0; i < charArr.length; i += 1){
let instance = charArr[i]
switch(instance){
case "&":
instance = amp;
console.log(amp)
break;
case "<":
instance = less;
break;
case ">":
instance = more;
break;
case "'":
instance = apost;
break;
case '"':
instance = quote;
break;
}
}
charArr = charArr.join("");
console.log(charArr)
}
console.log(convertHTML("Dolce & Gabbana")
)
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36
Challenge: Intermediate Algorithm Scripting - Convert HTML Entities
Link to the challenge: