//要求把arr的每个一单元打印在页面上 /* var arr = ['a', 'b', 'c', 'd']; document.write(arr[0] + '<br />'); document.write(arr[1] + '<br />'); document.write(arr[2] + '<br />'); document.write(arr[3] + '<br />'); */ var arr = ['a','b','c','d']; for(var i = 0;i < arr.length;i++)//可以改为(var i = 0,len = arr.length;i < len;i++) {document.write(arr[i] + '<br />');}