标签:循环 fit code padding second pad cell array order
JS数组的遍历方法有两种:
第一种:一般的for循环,例如:
1
2
3
4
|
var a = new Array( "first" , "second" , "third" ) for ( var i = 0;i < a.length; i++) { document.write(a[i]+ "," ); } |
输出的结果:fitst,second,third
第一种:用for...in 这种遍历的方式,例如:
1
2
3
4
|
var arr = new Array( "first" , "second" , "third" ) for ( var item in arr) { document.write(arr[item]+ "," ); } |
输出的结果:fitst,second,third
标签:循环 fit code padding second pad cell array order
原文地址:http://www.cnblogs.com/winyh/p/6668878.html