如何将以下所有代码转换为字符串?
document.body.innerHTML = 'some text with "special" symbols like ' + " ' " + ' and like \' & \'';
答案 0 :(得分:0)
您可以将字符串声明为var:
var myString = 'Some text with "special" symbols like ';
myString += '" " and like';
myString += " \' & \'";
document.body.innerHTML = myString;
答案 1 :(得分:0)
var x = "document.body.innerHTML = 'some text with \"special\" symbols like ' + \" ' \" + ' and like \' & \'';";
逃离内心"在使用\"
的作业中