JSFiddle - React, Tailwind, and code Playground

by Geo George

JavaScript

function ConvChar( str ) {
  c = {'<':'&lt;', '>':'&gt;', '&':'&amp;', '"':'&quot;', "'":'&#039;',
       '#':'&#035;' };
  return str.replace( /[<&>'"#]/g, function(s) { return c[s]; } );
}


alert(ConvChar("WOMEN&amp;#039;S EMPOWERMENT"))