JSFiddle - React, Tailwind, and code Playground

by ronnjoe

JavaScript

//Escape HTML

function escapeHtml(text) {
  var characters = {
    '&': '&',
    '"': '"',
    "'": ''',
    '<': '&lt;',
    '>': '&gt;'
  };
  return (text + "").replace(/[<>&"']/g, function(m){
    return characters[m];
  });
};

var abc = escapeHtml("CVG5->PR-NOROH->PR-TAYMI,CVG5->EWR5,CVG5->UPS_WPORT_TEMP,CVG5->DDU-CVG5-U-105,CVG5->SP-HOTX");
                     console.log(abc);