- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript String Concatenation
JavaScript Strings
JavaScript String Concatenation
Concatenation joins strings together into a longer one.
The plus operator is the usual way.
Template literals are usually clearer once more than two pieces are involved.
Example
Example
javascript
const first = "Ada";
const last = "Lovelace";
console.log(first + " " + last);The space has to be added deliberately.
Ways to Join
+ joins two strings.
+= adds to the end of an existing one.
concat and template literals do the same job.
