最佳答案
所有主流浏览器的当前版本都接受多行字符串。
Note: this technique is apparently not in compliance with browser standards; however, it works out fine when tested across all current versions of the major browsers.
- 一些在线工具如 JSLint 不允许这样做
- 多行字符串在 JavaScript 中可能很危险,因为如果您不小心在转义字符 (
\
) 和新行之间放置了一个空格,一切都会变得一团糟。 (@ripper234 评论)
多行字符串文字是 disallowed by the Google Style Guide .
关于javascript - 哪些浏览器支持多行字符串?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13808042/