1.concat():用于连接两个或多个字符串。
1).语法:string.concat(string1, string2, ..., stringX)
(string1, string2, ..., stringX:必需。将被连接为一个字符串的一个或多个字符串对象。)
2).该方法没有改变原有字符串,但是会返回连接两个或多个字符串新字符串。
3).返回值类型:String
<script> //连接两个字符串: var str1 = "Hello "; var str2 = "world!"; var n = str1.concat(str2); console.log(n) //Hello world! //连接3个字符串: var str11="Hello "; var str21="world!"; var str31=" Have a nice day!"; var n1 = str11.concat(str21,str31); console.log(n1) //Hello world! Have a nice day! </script>