[英]Have problem with multi-line string in javascript
This works: 这有效:
alert('foo\
bar'
)
But this is causing syntax error: 但这会导致语法错误:
t='test';
alert('<tr><td><b>' + t + '</b></td>\
<td></td><td>')
error is: 错误是:
SyntaxError: unterminated string literal
They two should be the same thing, why the first one works, while the second fails? 他们两个应该是同一个东西,为什么第一个工作,而第二个失败?
在第二个示例中,在反斜杠后面有一个尾随空格。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.