Convert HTML Entities help

Tell us what’s happening:

Your code so far

function convertHTML(str) {
  // :)
  str = str.replace(/</g,'&lt;');
  str = str.replace(/>/g,'&gt;');
  str = str.replace(/&/g,'&amp;');
  str = str.replace(/'/g,'&apos;');
  str = str.replace(/"/g,'&quot;');
  return str;

console.log(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/71.0.3578.98 Safari/537.36.

Link to the challenge:

can anyone tell me why am i not passing the remaining test cases ?

Sure - you convert the &lt; properly, then you check for an ampersand… Which you just injected with your &lt;.

Thanks @snowmonkey for the solution. I was struck on this problem for hours.