Visit Mozilla.org

Core JavaScript 1.5 Reference:Global Objects:String:concat

From MDC


Contents

[edit] Summary

Combines the text of two or more strings and returns a new string.

Method of String
Implemented in: JavaScript 1.2, NES3.0

[edit] Syntax

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

[edit] Parameters

string2...stringN 
Strings to concatenate to this string.

[edit] Description

concat combines the text from one or more strings and returns a new string. Changes to the text in one string do not affect the other string.

[edit] Examples

[edit] Example: Using concat

The following example combines strings into a new string.

s1="Oh "
s2="what a beautiful "
s3="mornin'."
s4=s1.concat(s2,s3) // returns "Oh what a beautiful mornin'."