Hi, I’m just wondering why is the thirdconsole.log not working as the second one. Since char[1]
is returning &
why can’t I just pass it in so that I can access the value of &
in the entities object?
**Your code so far**
let entities = {
"&" : "&",
"<" : "<",
">" : "gt;",
'"': """,
"'": "'"
}
let char = Object.keys(entities)
console.log(char[1]) // returns &
console.log(entities["&"]) // &
console.log(entities["char[1]"]) // undefined
**Your browser information:**
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.71 Safari/537.36 Edg/94.0.992.38
Challenge: Convert HTML Entities
Link to the challenge: