Hello,
I am currently with this challenge, where I wrote this easy code to solve it:
function convertHTML(str) {
if(str.indexOf("&") > -1){
str = str.split("&");
str = str.join("&");
}else if(str.indexOf("<") > -1){
str = str.split("<");
str = str.join("<");
}else if(str.indexOf(">") > -1){
str = str.split(">");
str = str.join(">");
}else if(str.indexOf("'") > -1){
str = str.split("'");
str = str.join("'");
}else if(str.indexOf('"') > -1){
str = str.split('"');
str = str.join(""");
}
console.log(str);
return str;
}
convertHTML("<>");
And this is the answer I get when ask to the console
<>
I can solve it in another way, but still, I would like to understand why this is happening, and why that “>” is not converting, probably I am missing something, but what?
Thank you!