Exemple, pour () {} pour traverser le tableau
Copier le code du code comme suit:
<script type = "text / javascript">
<! -
var arr = nouveau tableau (13,5, 3,4,5,6);
pour (var i = 0; i <arr.length; i ++) {
arr [i] = arr [i] /2.0;
}
alerte (arr);
// ->
</cript>
Exemple, pour en boucle partout dans le tableau
Copier le code du code comme suit:
<html>
<body>
<script type = "text / javascript">
var x
var myCars = new Array ()
myCars [0] = "saab"
myCars [1] = "Volvo"
myCars [2] = "BMW"
pour (x dans MyCars)
{{
document.write (myCars [x] + "<br />")
}
</cript>
</docy>
</html>