Javascript: concatenation String function concat () String. prototype. concat ()
The concat () method concatenates one or more strings with the original string to form a new string and return it without affecting the original string.
Syntax
str.concat(string2, string3[, ..., stringN])
Parameters
string2...stringN
Multiple strings connected to the original string
Description
The concat method concatenates one or more strings with the original string to form a new string and return it. The concat method does not affect the original string.
Example
The following example demonstrates how to combine multiple strings with the original string into a new string.
var hello = "Hello, ";console.log(hello.concat("Kevin", " have a nice day.")); /* Hello, Kevin have a nice day. */
Performance
We strongly recommend that you use the value assignment operator (+, + =) instead of the concat method.
Browser compatibility
Full platform support.