The concatenation operator (+) is the more common method of concatenating strings together.
This method call:
myString1.concat(myString2)
is functionally equivalent to:
myString1 + myString2
The second form is more intuitive in its meaning, and hence is recommended in favor of the concat() method.
<HTML>
<HEAD>
</HEAD>
<BODY>
<SCRIPT>
myString1 = "ABCDEFGHIJKLM";
myString2 = "NOPQRSTUVWXYZ";
document.write(myString1);
document.write("<BR>");
document.write(myString2);
document.write("<BR>");
document.write(myString1.concat(myString2));
document.write("<BR>");
</SCRIPT>
</BODY>
</HTML>| See also: | Array.concat() |
| Prev | Home | Next |
| String.Class | Up | String.constructor |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. | ||