哪些浏览器支持多行字符串? [英] Which browsers support multi-line strings?

查看:151
本文介绍了哪些浏览器支持多行字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪些浏览器支持多行字符串

"foo \
bar"

,我的主要怀疑是不支持它是IE。
哪个IE版本是第一个支持它的版本?

As usual, my main suspect for not supporting it is IE. Which IE version is the first that supports it?

推荐答案

所有当前版本的主流浏览器都接受多行字符串。

All current versions of the major browsers accept multi-line strings.


注意:这种技术显然不是在
符合浏览器标准;然而,当在所有当前版本的主要浏览器中测试
时,它工作正常。

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 comment)

  • 多行字符串文字 Google风格指南禁止。

    这篇关于哪些浏览器支持多行字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆