【发布时间】:2016-02-02 08:28:28
【问题描述】:
我有以下声明。
var myStr = "This is the first sentence. ";
myStr += "This is the second sentence. ";
我的最终目标是让语句看起来像这样:
这是第一句话。这是第二句。
但是当我在 console.log 中运行代码时,我得到了这个。
"This is the first sentence. This is the second sentence."
如何在不影响用作字符串的 qoutes 的情况下删除 qoutes
【问题讨论】:
-
通过连接以下两个字符串在多行上构建 myStr:“这是第一句。”和“这是第二句。”使用 += 运算符。
-
myStr 的值应该是 This is the first sentence。这是第二句话。使用 += 运算符构建 myStr(这些是赋值指令)。
标签: javascript string concatenation