Skip to content

Challenge Concatenating Strings with the Plus Equals Operator

SaintPeter edited this page · 1 revision
Clone this wiki locally

Concatenating Strings with the Plus Equals Operator

We can 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.";
Something went wrong with that request. Please try again.