Partager via


concat Method (String) (Windows Scripting - JScript)

 

Returns a string value containing the concatenation of two or more supplied strings.

Syntax

string1.concat([string2[, string3[, . . . [, stringN]]]])

Arguments

  • string1
    Required. The String object or literal to which all other specified strings are concatenated.

  • string2,. . ., stringN
    Optional. String objects or literals to concatenate to the end of string1.

Remarks

The result of the concat method is equivalent to: result = string1 + string2 + string3 + + stringN. 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 string1.

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

function concatDemo()
{
   var str1 = "ABCD"
   var str2 = "EFGH";
   var str3 = "1234";
   var str4 = "5678";
   var s = str1.concat(str2, str3, str4);
   // Output: "ABCDEFGH12345678"
   return(s);
}

Requirements

Version 3

Applies To: String Object (Windows Scripting - JScript)

Change History

Date

History

Reason

March 2009

Modified example.

Information enhancement.

See Also

Addition Operator (+) (Windows Scripting - JScript)
Array Object (Windows Scripting - JScript)
concat Method (Array) (Windows Scripting - JScript)