javascript中的数组的遍历

来源:互联网 发布:js http 状态码 编辑:程序博客网 时间:2024/05/16 05:43
<html><head><title>数组的遍历</title><script>var arr  = [123,"abc",false];//定义数组for(var x = 0 ; x < arr.length; x++){if(x != arr.length -1){//判断是否为最后一个元素document.write(arr[x] + ",");}else{document.write(arr[x]);}}</script></head><body><div id="time"></div></body></html>

0 0
原创粉丝点击