Tell us what’s happening:
When I try to create a string in an array with the HTML entities, when I put the semicolon at the end of the string it no longer interprets the string correctly.
The output for the code below is as described in the comments.
If I run the same code in CodePen, for the last line I get on the console:
(This is NOT what I posted – it got converted when I saved my post. When I look at it now when editing it looks right, after it’s posted it does not. I imagine it’s part of the same problem.)
[["&","&"],["<","<"],[">",">"],[""","""],["’","’"]]
which I think is what I’m going for.
(or would be, if it would show accurately here).
On the last line of my code below, there is supposed to be this comment:
// in FCC returns [["&","&"],[">","<"],[">",">"],[""","""],["’","’"]];
which shows when I’m editing but not in the posted version.
Your code so far
let subst;
subst = ["&", "&"]; // in FCC returns ["&","&"]
console.log(JSON.stringify(subst));
subst = ["&", "&"]; // in FCC returns ["&","&"]
console.log(JSON.stringify(subst));
subst = ["&", "&am;"]; // in FCC returns ["&","&am;"]
console.log(JSON.stringify(subst));
subst = ["&", "&a;"]; // in FCC returns ["&","&a;"]
console.log(JSON.stringify(subst));
subst = [["&", "&"], ["<", "<"], [">", ">"], ['"', """], ["'", "'"]] // in FCC returns [["&","&"],[">","<"],[">",">"],["\"","""],["'","'"]]; // in FCC returns [["&","&"],["<","<"],[">",">"],["\"","""],["'","'"]]
console.log(JSON.stringify(subst));
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36
.
Link to the challenge:
I’m not allowed to put in links, so had to take out the link that was automatically put here