i

JavaScript

concat()

concat() method is used to combine/concatenate two strings. This can be used instead of the “+” operator.

var string1 = “Hi, I am”;

var string2 = “ John.”

var newString = string1.concat(string2);

The value in the variable newString will be a concatenation of strings – string1 and string2, i.e., “Hi, I am John.”