Metoda cytatu ucieczki 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
let text = 'I\'m John Smith';
//I'm John Smith
let text2 = "I\"m Smith John";
//I"m Smith John
let text3 = `Es'cape "all" quotes`
//Es'cape "all" quotes