* fix: Chinese test suite Add localeTiltes, descriptions, and adjust test text and testStrings to get the automated test suite working. * fix: ran script, updated testStrings and solutions
1.8 KiB
1.8 KiB
id, title, challengeType, videoUrl, localeTitle
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
56533eb9ac21ba0edf2244b8 | Concatenating Strings with the Plus Equals Operator | 1 | 使用Plus Equals运算符连接字符串 |
Description
+=
运算符将字符串连接到现有字符串变量的末尾。这对于在多行上打破长字符串非常有帮助。 注意 留意空间。连接不会在连接字符串之间添加空格,因此您需要自己添加它们。
Instructions
myStr
几行: "This is the first sentence. "
和"This is the second sentence."
使用+=
运算符。使用+=
运算符,类似于它在编辑器中的显示方式。首先将第一个字符串分配给myStr
,然后添加第二个字符串。 Tests
tests:
- text: <code>myStr</code>应该有一个值<code>This is the first sentence. This is the second sentence.</code>
testString: assert(myStr === "This is the first sentence. This is the second sentence.");
- text: 使用<code>+=</code>运算符构建<code>myStr</code>
testString: assert(code.match(/\w\s*\+=\s*["']/g).length > 1 && code.match(/\w\s*\=\s*["']/g).length > 1);
Challenge Seed
// Example
var ourStr = "I come first. ";
ourStr += "I come second.";
// Only change code below this line
var myStr;
After Test
console.info('after the test');
Solution
// solution required