Tell us what’s happening:
I can’t figure out the difference between the less than sign that I extracted as a match from a string and the same symbol that I typed directly into the computer.
Why doesn’t found[0] === '<'
return true?
Your code so far
function convertHTML(str) {
console.clear();
// :)
var arr = str.split('');
var htmlRegEx = /& | < | > | ' | " /g;
var found = str.match(htmlRegEx);
console.log found; //logs ["<", "<"]
for (var i = 0; i < found.length; i ++) {
console.log(found[i] == '<'); //logs false
console.log(arr.indexOf(found[i]); //logs -1
console.log(arr.indexOf('<'); //logs 11
}
convertHTML("Hamburgers < Pizza < Tacos");
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.131 Safari/537.36
.
Link to the challenge: