Here you can find the source of escapeHTML()
String.prototype.escapeHTML = function() { return this.//from w w w . jav a2 s.c o m replace(/&/g, "&"). replace(/</g, "<"). replace(/>/g, ">"). replace(/\"/g, """); }; console.log("<&>".escapeHTML()); // -> "<&>"
String.prototype.escapeHTML = function(){ var str = this.replace(/</g, '<'); return str.replace(/>/g, '>'); };
String.prototype.escapeHTML = function() var m = {"&": "&", "<": "<", ">": ">", '"': '"', "'": ''', "/": '/'}; return String(this).replace(/[&<>"'\/]/g, function(s) return m[s]; });
String.prototype.escapeHTML = function () { return(this.replace(/&/g,'&').replace(/>/g,'>').replace(/</g,'<').replace(/"/g,'"')); };
var __entityMap = { "&": "&", "<": "<", ">": ">", '"': '"', "'": ''', "/": '/' }; String.prototype.escapeHTML = function() { ...