JSFiddle - React, Tailwind, and code Playground

by smacky311

JavaScript

var entity = {
    quot: '"',
    lt:   '<',
    gt:   '>'
};

document.writeln('&lt;&quot;&gt;'.replace(/&([^&;]+);/g,
                            function (a,b) {
                                document.writeln("a is: " + a);
                                document.writeln("b is: " + b);
                                
                                var r = entity[b];
                                document.writeln("r is: " + r);
                                return typeof r === 'string' ? r : a;
                            }
                           ));