1、循環語句(參考:http://www.jb51.net/article/80844.htm)javascript
一、for……in……java
<script type="text/javascript"> var x var mycars = new Array() mycars[0] = "寶馬" mycars[1] = "奔馳" mycars[2] = "賓利" for (x in mycars){document.write(mycars[x])} </script>
二、map.net
var x = [1,2,3,4].map( function(item) { return item * 10; } );
// And now x is [10,20,30,40]
三、arrayhtm
myStringArray = "abcdef"; for (var i = 0; i < myStringArray.length; i++) { alert(myStringArray[i]); }