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

JavaScript
JS 介绍
JS 怎样使用
JS 在哪使用
JS 变量
JS If...Else
JS Switch
JS 操作符
JS Popup Boxes
JS 函数
JS For 循环
JS While 循环
JS Break 循环
JS For...In
JS 事件
JS Try...Catch
JS Throw
JS onerror
JS 特殊字符
JS Guidelines
JS 对象介绍

JavaScript concat()方法


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-03-04   浏览: 377 ::
收藏到网摘: 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

登陆 | 还没注册?