JavaScript Concat
concat() joins one or more strings onto the end of the string it is called on and returns the combined result. In modern JavaScript the + operator or template literals do the same job more readably, but concat makes chaining explicit.
Syntax
str.concat(str1, str2, ...) Examples
| Input | Arguments | Output |
|---|---|---|
| "foo" | "bar" | "foobar" |
| "a" | "b", "c" | "abc" |
| ↳ concat accepts multiple arguments. | ||
When to use it
- Build a string from several parts in a pipeline.
Gotchas
- For readability, prefer `${a}${b}` template literals or a + b in everyday code.
Try it live
Type your input and see Concat transform it instantly.
Want to go further? Chain Concat with other functions, pipe one output into the next and watch your data transform in the visual Playground.