JavaScript » String » concat

Syntax:
object.concat(strName2, strName3....strName[n])

This method joins the text contained in one string with the text from other specified strings and returns a new string.

This method joins the text contained in one string with the text from other specified strings and returns a new string.

Examples

Code:
myString1 = new String("This demonstrates the ")
myString2 = new String("concat method.")
document.write(myString1.concat(myString2))
Output:
This demonstrates the concat method.
Explanation:

This code combines the text contained in two specified strings and writes the concatenated string to the document.