JavaScript Concatenate Strings

JavaScript string concatenation; Through this tutorial, i am going to show you how to join or concatenate string using javaScript concat() method with examples.

JavaScript String concat()

JavaScript concat() method is used to add or join or combine two or more strings together and it will return a new string.

Syntax of JavaScript String concat()

The following syntax of JavaScript String concat() ; as shown below:

string.concat(string1, string2, string3, ...., stringX);

Parameters of string replace method

ParameterDescription
string one, string two, string three, …, stringXThis is required. The strings to be combined or added

Example 1 – Join Two String in JavaScript

See the following example for join two more string in the original string using the concat() method in javaScript:

var originalString = "Hello, ";
var str1 = "developers!";
var str2 = " Must read this javascript string method for add two or more strings together!";
var res = originalString.concat(str1, str2);

Output :- Hello, developers! Must read this javascript string method for add two or more strings together!

More JavaScript Tutorials

Be First to Comment

Leave a Reply

Your email address will not be published.