本文实例讲述了JavaScript通过join函数连接数组里所有元素的方法。分享给大家供大家参考。具体实现方法如下:
<script type="text/javascript">var days = ["Sunday","Monday","Tuesday","Wednesday", "Thursday","Friday","Saturday"];document.write("days:"+days.join(","));</script>
输出结果如下:
days:Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday
希望本文所述对大家的javascript程序设计有所帮助。
新闻热点
疑难解答