Convert String to HTML entity - Node.js String

Node.js examples for String:HTML String

Description

Convert String to HTML entity

Demo Code


String.prototype.entityify = function () {
    return this.//  www  .j  ava 2  s .  com
        replace(/&/g, '&').
        replace(/</g, '&lt;').
        replace(/>/g, '&gt;');
};

Related Tutorials