js中数组拼接成字符串

来源:互联网 发布:欧姆龙plc编程软件 编辑:程序博客网 时间:2024/05/17 09:11

在本例中,我们将使用分隔符来分隔数组中的元素:

<script type="text/javascript">var arr = new Array(3)arr[0] = "George"arr[1] = "John"arr[2] = "Thomas"document.write(arr.join("."))</script>

输出:

George.John.Thomas
0 0