Description
The concat() method is used to join two or more strings.
This method has the form:
string.concat(str1,...,strX)
Parameter | Description |
---|---|
str1,...,strX | (required) The strings to be joined |
Note: This method does not change the existing strings, it only returns a copy of the joined strings.
Examples
The following example shows the basic use of this method.
<script>
var s1 = "Hello ";
var s2 = "from ";
var s3 = "JavaScript";
document.write(s1.concat(s2,s3));
</script>
This produces the following result:
Browser Support
Firefox | IE | Chrome | Opera | Safari |
---|---|---|---|---|