JavaScript字符串中的双引号 [英] Double quote in JavaScript string
本文介绍了JavaScript字符串中的双引号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在JavaScript字符串中包含双引号以便在浏览器中显示?
How can I include a double quote in a JavaScript string to be shown in the browser?
我正在处理JavaScript作业,并且必须包含双引号如下图所示:
I am working on my JavaScript homework and I have to include double quotes in the middle of my list as shown below:
if (i == 0) {
error += "<li> this is not the name "....." </li>\n"
}
推荐答案
使用单引号。
Use single quotes.
error += '<li> this is not the name "....." </li>\n';
或者转义双引号。
error += "<li> this is not the name \".....\" </li>\n";
这篇关于JavaScript字符串中的双引号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文