[英]Need help concatenating .JS
I have the following statement.我有以下声明。
var myStr = "This is the first sentence. ";
myStr += "This is the second sentence. ";
My end goal is to make the statement appear like this:我的最终目标是使语句看起来像这样:
This is the first sentence.这是第一句话。 This is the second sentence.
这是第二句话。
But when i run code in console.log I get this instead.但是当我在console.log 中运行代码时,我得到了这个。
"This is the first sentence. This is the second sentence."
How do i remove the qoutes without affecting the qoutes used as strings如何在不影响用作字符串的 qoutes 的情况下删除 qoutes
The quotes are added by console.log
to characterise the logged value as a string.引号由
console.log
添加以将记录的值表征为字符串。
There's nothing wrong with your concatenation, everything is working as expected.您的连接没有任何问题,一切都按预期工作。 In case you need control over your exact output, use
process.stdout.write
insted.如果您需要控制您的确切输出,请使用
process.stdout.write
insted。
var myStr = "This is the first sentence. " + "This is the second sentence.";
只需要在(.) 之后有空格就可以了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.