+运算符与String值一起使用时,它被称为连接运算符。您可以通过将它们连接在一起来构建其他字符串中的新字符串。 例 “我叫艾伦,'+'我连接起来。”注意
myStr "This is the start. "和"This is the end."使用+运算符。 myStr应该有一个值This is the start. This is the end.
testString: 'assert(myStr === "This is the start. This is the end.", "myStr should have a value of This is the start. This is the end.");'
- text: 使用+运算符构建myStr
testString: 'assert(code.match(/([""]).*([""])\s*\+\s*([""]).*([""])/g).length > 1, "Use the + operator to build myStr");'
- text: 应使用var关键字创建myStr 。
testString: 'assert(/var\s+myStr/.test(code), "myStr should be created using the var keyword.");'
- text: 确保将结果分配给myStr变量。
testString: 'assert(/myStr\s*=/.test(code), "Make sure to assign the result to the myStr variable.");'
```