Example, for () {} to traverse the array
Copy code code as follows:
<script type = "text/javascript">
<!--
var aRR = New Array (13.5, 3,4,5,6);
for (var I = 0; I <arr.Length; i ++) {
arr [i] = Arr [i] /2.0;
}
alert (ARR);
//->
</script>
Example, for in loop all over the array
Copy code code as follows:
<html>
<body>
<script type = "text/javascript">
var x
var mycars = new array ()
mycars [0] = "Saab"
mycars [1] = "Volvo"
mycars [2] = "bmw"
for (x in mycars)
{{
document.write (mycars [x] + "<br />")
}
</script>
</body>
</html>