Latest

recent

JavaScript concat() Method

Definition and Usage

The concat() method is used to join two or more strings.

Syntax

stringObject.concat(stringX,stringX,...,stringX)

Parameter Description
stringX Required. One or more string objects to be joined to a string


Example

In the following example we will create two strings and show them as one using concat():

<script type="text/javascript">
var str1="Hello ";
var str2="world!";
document.write(str1.concat(str2));
</script>

The output of the code above will be:

Hello world!
JavaScript concat() Method Reviewed by 1000sourcecodes on 02:14 Rating: 5
Powered by Blogger.