JSFiddle - React, Tailwind, and code Playground
by naokiota
JavaScript
if (!String.prototype.addslashes) {
String.prototype.addslashes = function () {
return this.replace(/[\\"']/g, '\\$&')
.replace(/\u0000/g, '\\0');
};
}
var str = 'tes"t';
alert(str.addslashes());