JavaScript concat method
The concat method concatenates two or more strings, and its syntax is as follows:
The code copy is as follows:
str_object.concat(str1, str2, ...)
str_object is the first string (object) that needs to be connected, str1 is the second string that needs to be connected, str2 is the third string that needs to be connected, and so on, at least one str1 is required.
concat instance
The code copy is as follows:
<script language="JavaScript">
var str = "www";
var str1 = ".";
var str2 = "jb51";
var str3 = ".";
var str4 = "net";
document.write( str.concat(str1, str2, str3, str4) );
</script>
Run this example and output:
www.VeVB.COM
Tip: It is usually more convenient to use the + algorithm to connect strings. For details, please refer to "JavaScript Operator".