--- id: 56533eb9ac21ba0edf2244b7 title: Concatenating Strings with Plus Operator challengeType: 1 videoUrl: https://scrimba.com/c/cNpM8AN forumTopicId: 16802 localeTitle: Конкатенация строк с помощью оператора Plus --- ## Description
В JavaScript, когда оператор + используется со значением String , он называется оператором конкатенации . Вы можете создать новую строку из других строк путем конкатенации их вместе. пример
«Меня зовут Алан, +, я конкатенирую».
Заметка
Следите за пробелами. Конкатенация не добавляет пробелов между конкатенированными строками, поэтому вам нужно будет добавить их самостоятельно.
## Instructions
Создайте myStr из строк "This is the start. " и "This is the end." используя оператор + .
## Tests
```yml tests: - text: 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: Use the + operator to build myStr testString: assert(code.match(/(["']).*(["'])\s*\+\s*(["']).*(["'])/g).length > 1); - text: myStr should be created using the var keyword. testString: assert(/var\s+myStr/.test(code)); - text: Make sure to assign the result to the myStr variable. testString: assert(/myStr\s*=/.test(code)); ```
## Challenge Seed
```js // Example var ourStr = "I come first. " + "I come second."; // Only change code below this line var myStr; ```
### After Tests
```js (function(){ if(typeof myStr === 'string') { return 'myStr = "' + myStr + '"'; } else { return 'myStr is not a string'; } })(); ```
## Solution
```js var ourStr = "I come first. " + "I come second."; var myStr = "This is the start. " + "This is the end."; ```