--description--
In JavaScript, when the +
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
'My name is Alan,' + ' I concatenate.'
Note: Watch out for spaces. Concatenation does not add spaces between concatenated strings, so you'll need to add them yourself.
Example:
const ourStr = "I come first. " + "I come second.";
The string I come first. I come second.
would be displayed in the console.
--instructions--
Build myStr
from the strings This is the start.
and This is the end.
using the +
operator. Be sure to include a space between the two strings.
--hints--
myStr
should have a single space character between the two strings.
assert(/start\. This/.test(myStr));
myStr
should have a value of the string This is the start. This is the end.
assert(myStr === 'This is the start. This is the end.');
You should use the +
operator to build myStr
.
assert(__helpers.removeJSComments(code).match(/(["']).*\1\s*\+\s*(["']).*\2/g));
myStr
should be created using the const
keyword.
assert(/const\s+myStr/.test(__helpers.removeJSComments(code)));
You should assign the result to the myStr
variable.
assert(/myStr\s*=/.test(__helpers.removeJSComments(code)));
--seed--
--after-user-code--
(function(){
if(typeof myStr === 'string') {
return 'myStr = "' + myStr + '"';
} else {
return 'myStr is not a string';
}
})();
--seed-contents--
const myStr = ""; // Change this line
--solutions--
const myStr = "This is the start. " + "This is the end.";