+
se usa con un valor de String
, se llama operador de concatenación . Puede construir una nueva cadena a partir de otras cadenas concatenándolas juntas. Ejemplo 'Mi nombre es Alan,' + 'Concatené'.Nota
myStr
partir de las cadenas "This is the start. "
y "This is the end."
utilizando el operador +
. myStr
debe tener un valor de 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: Usa el operador +
para construir myStr
testString: 'assert(code.match(/([""]).*([""])\s*\+\s*([""]).*([""])/g).length > 1, "Use the +
operator to build myStr
");'
- text: myStr
debe crearse usando la palabra clave var
.
testString: 'assert(/var\s+myStr/.test(code), "myStr
should be created using the var
keyword.");'
- text: Asegúrese de asignar el resultado a la variable myStr
.
testString: 'assert(/myStr\s*=/.test(code), "Make sure to assign the result to the myStr
variable.");'
```