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
Parameter | Description |
---|---|
string one, string two, string three, …, stringX | This 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
Recommended:-Guide to JavaScript Strings By Examples
Recommended:-Javascript String ToLowerCase
Recommended:-JavaScript Convert String to UpperCase
Recommended:-JavaScript Data Types
Recommended:-JavaScript Arithmetic Operators
Recommended:-JavaScript Unary Operators Tutorial
Recommended:-JavaScript Assignment Operators
Recommended:-JavaScript Logical Operators with Example
Recommended:-JavaScript Comparison Operators Examples
Recommended:-JavaScript Ternary Operators Examples
Recommended:-JavaScript Switch Case Statement Tutorial
Recommended:-JavaScript While, Do-While, For and For-In Loops
Recommended:-JavaScript While Loop with Example
Recommended:-JavaScript do-while Loop with Example
Recommended:-JavaScript for Loop with Examples
Recommended:-Continue Statement in JavaScript
Recommended:-JavaScript Error Try-Catch Statement
Recommended:-Break Statement in JavaScript