Método de cita de escape de JavaScript
stringToEscape.replace(/"/g, '\\\"')
feddynventor
stringToEscape.replace(/"/g, '\\\"')
var string = 'this isn\'t a double quoted string';
var string = "this isn\"t a single quoted string";
// ^ ^ same types, hence we need to escape it with a backslash