Conver Html entites, help me to send

Conver Html entites, help me to send
0

#1

I’m trying to send my code but it doesn’t work and I have not warning or error?

function convertHTML(str) {
  var arrHtml = ['&', '<', '>', '"', "'"],
      arrEntites = ['&amp;', '&lt;', '&gt;', '&quot;', '&apos;'],
      result = void 0,
      arr = [];

  arr = str.split('');

  for (var i = 0, l = arr.length; i < l; i++) {
    var v = arr[i];

    if (arrHtml.indexOf(v) != -1) {
      arr[i] = arrEntites[arrHtml.indexOf(v)];
    }
  }

  result = arr.join('');
  return result;
}

convertHTML("Dolce & Gabbana");

#3

Thanks in a new window incognito it works.