Here you can find the source of escape()
// add escape for string String.prototype.escape = function () { var entityMap = { "&": "&", "<": "<", ">": ">", '"': '"', "'": ''' };/* w ww. j ava 2s .c o m*/ return this.replace(/[&<>"']/g, function (s) { return entityMap[s]; }); };
String.prototype.escape = function(){ return this.replace(/([ #;&,.+*~\':"!^$[\]()=>|\/])/g,'\\$1')
String.prototype.escape = function() { var tagsToReplace = { '&': '&', '<': '<', '>': '>' }; return this.replace(/[&<>]/g, function(tag) { return tagsToReplace[tag] || tag; }); ...
String.prototype.escape = function () { var tagsToReplace = { '&': '&', '<': '<', '>': '>' }; return this.replace(/[&<>]/g, function (tag) { return tagsToReplace[tag] || tag; }); ...
String.prototype.escape = function () { var entityMap = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '/': '/' }; ...
String.prototype.escape = function() { return this .replace(/&(?!\w+;)/g, '&') .replace(/</g, '<') .replace(/>/g, '>') .replace(/"/g, '"'); };