This documentation is archived and is not being maintained.

concat Method (String)

Returns a string value containing the concatenation of the current string with any supplied strings.

function concat([string1 : String [, ... [, stringN : String]]]]) : String

Arguments

string1, ... , stringN
Optional. String objects or literals to concatenate to the end of the current string.

Remarks

The result of the concat method is equivalent to: result = curstring + string1 + ... + stringN. The curstring refers the string stored in the object that supplies the concat method. A change of value in either a source or result string does not affect the value in the other string. If any of the arguments are not strings, they are first converted to strings before being concatenated to curstring.

Example

The following example illustrates the use of the concat method when used with a string:

function concatDemo(){
   var str1 = "ABCDEFGHIJKLM"
   var str2 = "NOPQRSTUVWXYZ";
   var s = str1.concat(str2);
   // Return concatenated string.
   return(s);
}

Requirements

Version 3

See Also

Addition Operator (+) | Array Object | concat Method (Array)

Applies To: String Object

Show: