当前位置: 首页 > 网络学院 > 客户端脚本教程 > JavaScript > JavaScript concat()方法

JavaScript
JS 字符串
JS Date
JS数组,JS Array
JS Boolean
JS Math
JS HTML DOM
JS Browser
JS Cookies
JS 校验
JS Animation
JS Image Maps
JS Timing
JS 建立对象
JS 摘要
JS 实例
JS 对象实例
JS DOM 实例
JS数组对象参考
JS布尔对象参考
JS日期对象参考

JavaScript concat()方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 378 ::
收藏到网摘: n/a

Definition and Usage
定义与用法

The concat() method is used to join two or more strings.
concat()方法可用来将两个或两个以上的字符串组合到一起

Syntax
举例

stringObject.concat(stringX,stringX,...,stringX)

Parameter
参数
Description
描述
stringX Required. One or more string objects to be joined to a string
必选。需要组合的一或多个对象


Example
举例

In the following example we will create two strings and show them as one using concat():
下面我们将使用concat()方法将两个字符串组合到一起:

<script type="text/javascript">
var str1="Hello "
var str2="world!"
document.write(str1.concat(str2))
</script>

The output of the code above will be:
输出结果为:

Hello world!


Try-It-Yourself Demos
尝试与演示

concat()
How to use concat() to join two strings.
如何concat()方法来将两个或两个以上的字符串组合到一起

评论 (0) All

登陆 | 还没注册?