Intermediate Algorithm Scripting: Convert HTML Entities opinion/improvement

I want opinion on my solution. Is this acceptable solution? How can I improve it?

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

console.log(convertHTML("Dolce & Gabbana"));

Your code works, but it is repetitive. If you wish to improve it you could try a solution where you only use the replace() method once.