Basic JavaScript (27/111) | Concatenating Strings with the Plus Equals Operator | freeCodeCamp

preview_player
Показать описание
Basic JavaScript (27/111) | Concatenating Strings with the Plus Equals Operator | freeCodeCamp

We can also use the += operator to concatenate a string onto the end of an existing string variable. This can be very helpful to break a long string over several lines.

Note
Watch out for spaces. Concatenation does not add spaces between concatenated strings, so you'll need to add them yourself.

Example:
var ourStr = "I come first. ";
ourStr += "I come second.";
// ourStr is now "I come first. I come second."

Рекомендации по теме