String.prototype.concat()
concat(...strings) string · Added in vES5 · Updated March 13, 2026 · String Methods The concat() method merges two or more strings into a new string. It takes one or more string arguments and appends them to the original string in the order they were passed. The method does not modify either string — it returns a brand new string with all values combined.
This method is useful when you need to join multiple strings together in a clear, explicit way. While JavaScript provides other concatenation methods like the + operator and template literals, concat() makes the intent to join strings unmistakable in your code.
Syntax
concat(...strings)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
strings | ...string | — | One or more strings to concatenate. Non-string values are converted to strings automatically. |
Examples
Basic usage
const str1 = "Hello";
const str2 = " ";
const str3 = "World!";
console.log(str1.concat(str2, str3));
// "Hello World!"
Multiple strings
const greeting = "Hello".concat(" ", "from", " ", "JavaScript!");
console.log(greeting);
// "Hello from JavaScript!"
With non-string values
// concat() converts numbers to strings
console.log("Number: ".concat(42));
// "Number: 42"
// Arrays are converted using their toString() method
console.log("Array: ".concat([1, 2, 3]));
// "Array: 1,2,3"
Common Patterns
While concat() works, the + operator and template literals are generally preferred in modern JavaScript for their readability and performance:
// Using concat
const result = str1.concat(str2);
// Using + operator (commonly used)
const result = str1 + str2;
// Using template literals (most flexible)
const result = `${str1}${str2}`;
Use concat() when you need to explicitly signal the intent to join strings, particularly in functional programming contexts where method chaining is preferred. For simple cases, the + operator or template literals are typically more readable.