freeCodeCamp/guide/english/certifications/javascript-algorithms-and-d.../basic-javascript/concatenating-strings-with-.../index.md

535 B

title
Concatenating Strings with the Plus Equals Operator

Concatenating Strings with the Plus Equals Operator

The '+=' operator can concatenate (link) strings easily. Make sure your spelling is right, and you've left appropriate spaces.

var str = "Hello ";
str += "coding"; // Now the string reads "Hello coding"
str += "camper!"; // And now the string reads "Hello codingcamper!"