Extracted Match Vs. Same Sign Typed Directly

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();
  // &colon;&rpar;


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:

You’re looking for literally " < " in the regex. There are two of these in the string - inbetween Hamburgers and Pizza, and inbetween Pizza and Tacos… You then look in the match array literally for “<”, and there is nothing that matches that, so therefore no match.

" < "

is not the same as

"<"

This

var htmlRegEx = /& | < | > | ' | " /g;

means:

MATCH ampersand space OR space less-than space OR space greater-than space OR space single-quote space OR space double-quote space

Also, the code you have here can’t work, it’s full of syntax errors?