日常眼瞎之:freecodecamp 用“+=”连接字符串

题目要求是这个样子的:
1.myStr should have a value of This is the first sentence. This is the second sentence.
2.Use the += operator to build myStr;

我的代码是这个样子的:
 var myStr = "This is the first sentence.";
 myStr += "This is the second sentence.";

然鹅有问题,没有完成要求一,百思不得其解,于是请教度娘,看到了别人的代码:
var myStr="This is the first sentence.";
myStr += " This is the second sentence.";

我觉得一毛一样,还是百思不得其解,于是一句一句看(总共才两句......)
终于发现This is the second sentence前面有个空格......一把辛酸泪

猜你喜欢

转载自blog.csdn.net/qq_40642021/article/details/80774875