+
используется со значением 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: myStr
должен быть создан с использованием ключевого слова var
.
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.");'
```