+
operator is used with a String
value, it is called the concatenation operator. You can build a new string out of other strings by concatenating them together.
Example
```js
'My name is Alan,' + ' I concatenate.'
```
NotemyStr
from the strings "This is the start. "
and "This is the end."
using the +
operator.
myStr
should have a value of This is the start. This is the end.
testString: assert(myStr === "This is the start. This is the end.");
- text: You should use the +
operator to build myStr
.
testString: assert(code.match(/(["']).*\1\s*\+\s*(["']).*\2/g));
- text: myStr
should be created using the var
keyword.
testString: assert(/var\s+myStr/.test(code));
- text: You should assign the result to the myStr
variable.
testString: assert(/myStr\s*=/.test(code));
```